am 8ab086d0: am da66e667: Merge "Make decoder more robust to inaccurate ASCs." into jb-dev
* commit '8ab086d0356f90bc1901d1c4e7e0687f6ac273c3':
Make decoder more robust to inaccurate ASCs.
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index bf7befd..e499a0b 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -267,6 +267,15 @@
inBuffer[0] = header->pBuffer + header->nOffset;
inBufferLength[0] = header->nFilledLen;
+ // Make the decoder more robust by pruning explicit backward compatible
+ // extension for LC, HE-AACv1 (SBR), HE-AACv2 (SBR + PS). We'll depend
+ // on implicit configuration.
+ if (inBufferLength[0] > 2) {
+ UCHAR aot = inBuffer[0][0] >> 3;
+ if (aot == 2 | aot == 5 | aot == 29) {
+ inBufferLength[0] = 2;
+ }
+ }
AAC_DECODER_ERROR decoderErr =
aacDecoder_ConfigRaw(mAACDecoder,
inBuffer,