summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2014-09-26 04:24:12 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-26 04:24:12 +0000
commit6ff947631cda2e3d4e47f97616dc70fd320d2c4a (patch)
tree4846ed3559f10c7ad31fd4178786e9b139512a9b /media
parentcd8ff071e90aaedc5507b63e73f0fed39b8057ae (diff)
parentea55da9434f674efaacaa443c97a411bdef4ff1a (diff)
downloadframeworks_av-6ff947631cda2e3d4e47f97616dc70fd320d2c4a.zip
frameworks_av-6ff947631cda2e3d4e47f97616dc70fd320d2c4a.tar.gz
frameworks_av-6ff947631cda2e3d4e47f97616dc70fd320d2c4a.tar.bz2
am ea55da94: Merge "Fix SoftAAC2 flush" into lmp-dev
* commit 'ea55da9434f674efaacaa443c97a411bdef4ff1a': Fix SoftAAC2 flush
Diffstat (limited to 'media')
-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 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++;
}