diff options
| author | 2010-02-01 13:02:39 -0800 | |
|---|---|---|
| committer | 2010-02-01 13:02:39 -0800 | |
| commit | 8ef96af97e200a62a3205085c79c6ca7b0e873ee (patch) | |
| tree | 7e8568343994b9a900c6efe5649526523360fd09 | |
| parent | 54ab1fadfa3a633d3b9110505b186e98866c04d8 (diff) | |
| parent | e331c7b2c4d9449c23e70067edeb0deadb95aa6e (diff) | |
Merge "The TI MP3 decoder lies about the number of channels it outputs, add a quirk for that."
| -rw-r--r-- | include/media/stagefright/OMXCodec.h | 1 | ||||
| -rw-r--r-- | media/libstagefright/OMXCodec.cpp | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 82dd2b52f0f3..f8bc7ab0bfbb 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -95,6 +95,7 @@ private: kRequiresAllocateBufferOnOutputPorts = 32, kRequiresFlushBeforeShutdown = 64, kDefersOutputBufferAllocation = 128, + kDecoderLiesAboutNumberOfChannels = 256, }; struct BufferInfo { diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index e17fbb8ed31e..90bbdfe5b083 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -290,6 +290,7 @@ uint32_t OMXCodec::getComponentQuirks(const char *componentName) { } if (!strcmp(componentName, "OMX.TI.MP3.decode")) { quirks |= kNeedsFlushBeforeDisable; + quirks |= kDecoderLiesAboutNumberOfChannels; } if (!strcmp(componentName, "OMX.TI.AAC.decode")) { quirks |= kNeedsFlushBeforeDisable; @@ -2817,7 +2818,9 @@ void OMXCodec::initOutputFormat(const sp<MetaData> &inputFormat) { if ((OMX_U32)numChannels != params.nChannels) { LOGW("Codec outputs a different number of channels than " - "the input stream contains."); + "the input stream contains (contains %d channels, " + "codec outputs %ld channels).", + numChannels, params.nChannels); } mOutputFormat->setCString( @@ -2825,8 +2828,12 @@ void OMXCodec::initOutputFormat(const sp<MetaData> &inputFormat) { // Use the codec-advertised number of channels, as some // codecs appear to output stereo even if the input data is - // mono. - mOutputFormat->setInt32(kKeyChannelCount, params.nChannels); + // mono. If we know the codec lies about this information, + // use the actual number of channels instead. + mOutputFormat->setInt32( + kKeyChannelCount, + (mQuirks & kDecoderLiesAboutNumberOfChannels) + ? numChannels : params.nChannels); // The codec-reported sampleRate is not reliable... mOutputFormat->setInt32(kKeySampleRate, sampleRate); |