summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-08-23 10:32:35 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-23 10:32:35 -0700
commited422aa0dfab77312d25d52e7f204744ba16dc27 (patch)
treebd4499edf95a8dec8de1a125f643869f80d1ba40 /media
parent0e8f3d8060cecfa2046a421c120cb5d0320423ca (diff)
parenteca1762d92c43f2b7836941d14e453d4c0f9ed99 (diff)
downloadframeworks_av-ed422aa0dfab77312d25d52e7f204744ba16dc27.zip
frameworks_av-ed422aa0dfab77312d25d52e7f204744ba16dc27.tar.gz
frameworks_av-ed422aa0dfab77312d25d52e7f204744ba16dc27.tar.bz2
Merge "We were accidentally sending out an output buffer before the final port settings change"
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC.cpp b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
index f0a330f..2abdb56 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
@@ -378,23 +378,35 @@ void SoftAAC::onQueueFilled(OMX_U32 portIndex) {
// fall through
}
- if (mUpsamplingFactor == 2) {
- if (mConfig->desiredChannels == 1) {
- memcpy(&mConfig->pOutputBuffer[1024],
- &mConfig->pOutputBuffer[2048],
- numOutBytes * 2);
+ if (decoderErr == MP4AUDEC_SUCCESS || mNumSamplesOutput > 0) {
+ // We'll only output data if we successfully decoded it or
+ // we've previously decoded valid data, in the latter case
+ // (decode failed) we'll output a silent frame.
+
+ if (mUpsamplingFactor == 2) {
+ if (mConfig->desiredChannels == 1) {
+ memcpy(&mConfig->pOutputBuffer[1024],
+ &mConfig->pOutputBuffer[2048],
+ numOutBytes * 2);
+ }
+ numOutBytes *= 2;
}
- numOutBytes *= 2;
- }
- outHeader->nFilledLen = numOutBytes;
- outHeader->nFlags = 0;
+ outHeader->nFilledLen = numOutBytes;
+ outHeader->nFlags = 0;
- outHeader->nTimeStamp =
- mAnchorTimeUs
- + (mNumSamplesOutput * 1000000ll) / mConfig->samplingRate;
+ outHeader->nTimeStamp =
+ mAnchorTimeUs
+ + (mNumSamplesOutput * 1000000ll) / mConfig->samplingRate;
- mNumSamplesOutput += mConfig->frameLength * mUpsamplingFactor;
+ mNumSamplesOutput += mConfig->frameLength * mUpsamplingFactor;
+
+ outInfo->mOwnedByUs = false;
+ outQueue.erase(outQueue.begin());
+ outInfo = NULL;
+ notifyFillBufferDone(outHeader);
+ outHeader = NULL;
+ }
if (inHeader->nFilledLen == 0) {
inInfo->mOwnedByUs = false;
@@ -404,12 +416,6 @@ void SoftAAC::onQueueFilled(OMX_U32 portIndex) {
inHeader = NULL;
}
- outInfo->mOwnedByUs = false;
- outQueue.erase(outQueue.begin());
- outInfo = NULL;
- notifyFillBufferDone(outHeader);
- outHeader = NULL;
-
if (decoderErr == MP4AUDEC_SUCCESS) {
++mInputBufferCount;
}