summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2015-06-11 11:15:00 -0700
committerVignesh Venkatasubramanian <vigneshv@google.com>2015-06-11 20:14:43 +0000
commit08e8227514f5ab99822dfae8b4d39414646ff59d (patch)
treea1ec6a5364ee07c07d610a9e8e30142373d8f140
parentad9ef61e770c0751a9983aa5c9844dfeb9ed665b (diff)
downloadframeworks_av-08e8227514f5ab99822dfae8b4d39414646ff59d.zip
frameworks_av-08e8227514f5ab99822dfae8b4d39414646ff59d.tar.gz
frameworks_av-08e8227514f5ab99822dfae8b4d39414646ff59d.tar.bz2
SoftOpus: Fix output buffer capacity.
The output buffer size as per opus project's sample decoder [1] is 960*6*channel_count. Whereas in SoftOpus, we use 960*6 (without the channel count multiplier. Fixing it to include maximum number of channels possible as the multiplier. [1] http://git.xiph.org/?p=opus-tools.git;a=blob;f=src/opusdec.c;h=d085f04eacdfd49759ffdb73db805562ba396720;hb=f2a2e88b47f6f24083a37be476f140f677fe7160#l571 BUG=20721050 Change-Id: I323891a1b11491782bc093477b09e7757b885674
-rw-r--r--media/libstagefright/codecs/opus/dec/SoftOpus.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/media/libstagefright/codecs/opus/dec/SoftOpus.cpp b/media/libstagefright/codecs/opus/dec/SoftOpus.cpp
index 7ff9ee7..cb10bce 100644
--- a/media/libstagefright/codecs/opus/dec/SoftOpus.cpp
+++ b/media/libstagefright/codecs/opus/dec/SoftOpus.cpp
@@ -34,6 +34,12 @@ namespace android {
static const int kRate = 48000;
+// Opus uses Vorbis channel mapping, and Vorbis channel mapping specifies
+// mappings for up to 8 channels. This information is part of the Vorbis I
+// Specification:
+// http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html
+static const int kMaxChannels = 8;
+
template<class T>
static void InitOMXParams(T *params) {
params->nSize = sizeof(T);
@@ -101,7 +107,7 @@ void SoftOpus::initPorts() {
def.eDir = OMX_DirOutput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
- def.nBufferSize = kMaxNumSamplesPerBuffer * sizeof(int16_t);
+ def.nBufferSize = kMaxNumSamplesPerBuffer * sizeof(int16_t) * kMaxChannels;
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainAudio;
@@ -225,12 +231,6 @@ static uint16_t ReadLE16(const uint8_t *data, size_t data_size,
return val;
}
-// Opus uses Vorbis channel mapping, and Vorbis channel mapping specifies
-// mappings for up to 8 channels. This information is part of the Vorbis I
-// Specification:
-// http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html
-static const int kMaxChannels = 8;
-
// Maximum packet size used in Xiph's opusdec.
static const int kMaxOpusOutputPacketSizeSamples = 960 * 6;