diff options
author | Marco Nelissen <marcone@google.com> | 2015-01-09 15:44:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-09 15:44:01 +0000 |
commit | a2d2c48a7ca3331ee77421d776e9849651b488c1 (patch) | |
tree | fe19390454ed613f6f391bb406a06581935f9b7f | |
parent | c52af00beda4477d0fd00c3071e6ffd9c465430b (diff) | |
parent | ca6630c6065a9c93dde7b08b267c4d18314f935e (diff) | |
download | frameworks_av-a2d2c48a7ca3331ee77421d776e9849651b488c1.zip frameworks_av-a2d2c48a7ca3331ee77421d776e9849651b488c1.tar.gz frameworks_av-a2d2c48a7ca3331ee77421d776e9849651b488c1.tar.bz2 |
Merge "Don't signal an error at the end of a short file"
-rw-r--r-- | media/libstagefright/codecs/aacdec/SoftAAC2.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp index 7209cb3..495bad0 100644 --- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp +++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp @@ -929,30 +929,22 @@ void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) { } if (mEndOfInput) { - if (outputDelayRingBufferSamplesAvailable() > 0 - && outputDelayRingBufferSamplesAvailable() - < mStreamInfo->frameSize * mStreamInfo->numChannels) { - ALOGE("not a complete frame of samples available"); - mSignalledError = true; - notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); - return; - } - - if (mEndOfInput && !outQueue.empty() && outputDelayRingBufferSamplesAvailable() == 0) { + int ringBufAvail = outputDelayRingBufferSamplesAvailable(); + if (!outQueue.empty() + && ringBufAvail < mStreamInfo->frameSize * mStreamInfo->numChannels) { if (!mEndOfOutput) { - // send empty block signaling EOS + // send partial or empty block signaling EOS mEndOfOutput = true; BufferInfo *outInfo = *outQueue.begin(); OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader; - if (outHeader->nOffset != 0) { - ALOGE("outHeader->nOffset != 0 is not handled"); - mSignalledError = true; - notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); - return; + INT_PCM *outBuffer = reinterpret_cast<INT_PCM *>(outHeader->pBuffer + + outHeader->nOffset); + int32_t ns = outputDelayRingBufferGetSamples(outBuffer, ringBufAvail); + if (ns < 0) { + ns = 0; } - - outHeader->nFilledLen = 0; + outHeader->nFilledLen = ns; outHeader->nFlags = OMX_BUFFERFLAG_EOS; outHeader->nTimeStamp = mBufferTimestamps.itemAt(0); @@ -991,7 +983,7 @@ void SoftAAC2::onPortFlushCompleted(OMX_U32 portIndex) { } int32_t ns = outputDelayRingBufferGetSamples(0, avail); if (ns != avail) { - ALOGE("not a complete frame of samples available"); + ALOGW("not a complete frame of samples available"); break; } mOutputBufferCount++; |