Fix the software AAC decoder's AAC+ detection to ignore malformed frames
at the beginning of the stream.
Change-Id: Ib990848c696896e7d43c80dec8119dec35704b74
related-to-bug: 5122512
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC.cpp b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
index bbd6dbb..f0a330f 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
@@ -316,7 +316,7 @@
* Thus, we could not say for sure whether a stream is
* AAC+/eAAC+ until the first data frame is decoded.
*/
- if (mInputBufferCount <= 2) {
+ if (decoderErr == MP4AUDEC_SUCCESS && mInputBufferCount <= 2) {
LOGV("audio/extended audio object type: %d + %d",
mConfig->audioObjectType, mConfig->extendedAudioObjectType);
LOGV("aac+ upsampling factor: %d desired channels: %d",
@@ -410,7 +410,9 @@
notifyFillBufferDone(outHeader);
outHeader = NULL;
- ++mInputBufferCount;
+ if (decoderErr == MP4AUDEC_SUCCESS) {
+ ++mInputBufferCount;
+ }
}
}