diff options
author | Marco Nelissen <marcone@google.com> | 2014-09-25 14:25:18 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-09-25 14:26:33 -0700 |
commit | 4edf384a512748b871f24e4c03afaa3c1151ca23 (patch) | |
tree | 2f2421c2a2cc19363ec4dc059dc88a8b6f8d3500 /media | |
parent | c0d17e349901c3ccf6d15b7dcdf7fa30139c9750 (diff) | |
download | frameworks_av-4edf384a512748b871f24e4c03afaa3c1151ca23.zip frameworks_av-4edf384a512748b871f24e4c03afaa3c1151ca23.tar.gz frameworks_av-4edf384a512748b871f24e4c03afaa3c1151ca23.tar.bz2 |
Fix SoftAAC2 flush
If there were less than a full frame worth of samples in the ring
buffer, then flush would loop forever trying to empty the ring
buffer.
Bug: 17646525
Change-Id: I68ec87352a91ce3a96d05e9b3f60a6e7975f9156
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/codecs/aacdec/SoftAAC2.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp index fb27dca..e701e9e 100644 --- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp +++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp @@ -974,11 +974,15 @@ void SoftAAC2::onPortFlushCompleted(OMX_U32 portIndex) { mDecodedSizes.clear(); mLastInHeader = NULL; } else { - while (outputDelayRingBufferSamplesAvailable() > 0) { - int32_t ns = outputDelayRingBufferGetSamples(0, - mStreamInfo->frameSize * mStreamInfo->numChannels); - if (ns != mStreamInfo->frameSize * mStreamInfo->numChannels) { + int avail; + while ((avail = outputDelayRingBufferSamplesAvailable()) > 0) { + if (avail > mStreamInfo->frameSize * mStreamInfo->numChannels) { + avail = mStreamInfo->frameSize * mStreamInfo->numChannels; + } + int32_t ns = outputDelayRingBufferGetSamples(0, avail); + if (ns != avail) { ALOGE("not a complete frame of samples available"); + break; } mOutputBufferCount++; } |