summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/codecs/aacdec/SoftAAC2.cpp')
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index 287fcc8..1b6eac4 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -978,11 +978,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++;
}