aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-08-09 17:06:06 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2019-10-10 12:37:21 -0700
commitdbfa1cd71bbc5c0af382f47c222a72739bc101de (patch)
tree165d15d643ad62ea58710160eca68df9700ba0c7
parentcc825aecf5ff8c2c7027f7424d7933cd80d6f3bb (diff)
downloadfdk-aac-dbfa1cd71bbc5c0af382f47c222a72739bc101de.tar.gz
fdk-aac-dbfa1cd71bbc5c0af382f47c222a72739bc101de.tar.bz2
fdk-aac-dbfa1cd71bbc5c0af382f47c222a72739bc101de.zip
Fix assert in synchronization() for loas streams with multiple sub frames.
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Icb7d4b0b00a17367c8ec762b112fbb25268d9f67
-rw-r--r--libMpegTPDec/src/tpdec_lib.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/libMpegTPDec/src/tpdec_lib.cpp b/libMpegTPDec/src/tpdec_lib.cpp
index 506aed3..ede64c9 100644
--- a/libMpegTPDec/src/tpdec_lib.cpp
+++ b/libMpegTPDec/src/tpdec_lib.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -663,10 +663,14 @@ TRANSPORTDEC_ERROR transportDec_FillData(const HANDLE_TRANSPORTDEC hTp,
if (*pBytesValid == 0) {
/* nothing to do */
return TRANSPORTDEC_OK;
- }
-
- if (hTp->numberOfRawDataBlocks <= 0) {
+ } else {
+ const int bytesValid = *pBytesValid;
FDKfeedBuffer(hBs, pBuffer, bufferSize, pBytesValid);
+
+ if (hTp->numberOfRawDataBlocks > 0) {
+ hTp->globalFramePos += (bytesValid - *pBytesValid) * 8;
+ hTp->accessUnitAnchor[layer] = FDKgetValidBits(hBs);
+ }
}
}
@@ -1151,6 +1155,11 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
&rawDataBlockLength, &fTraverseMoreFrames,
&syncLayerFrameBits, &fConfigFound,
&headerBits);
+ if (headerBits > bitsAvail) {
+ err = (headerBits < (INT)hBs->hBitBuf.bufBits)
+ ? TRANSPORTDEC_NOT_ENOUGH_BITS
+ : TRANSPORTDEC_SYNC_ERROR;
+ }
if (TPDEC_IS_FATAL_ERROR(err)) {
/* Rewind - TPDEC_SYNCSKIP, in order to look for a synch one bit ahead
* next time. Ensure that the bit amount lands at a multiple of
@@ -1181,8 +1190,6 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
}
if (err == TRANSPORTDEC_NOT_ENOUGH_BITS) {
- /* Enforce reading of new data */
- hTp->numberOfRawDataBlocks = 0;
break;
}
@@ -1273,7 +1280,9 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
/* Rewind for retry because of not enough bits */
if (err == TRANSPORTDEC_NOT_ENOUGH_BITS) {
FDKpushBack(hBs, headerBits);
+ hTp->numberOfRawDataBlocks = numRawDataBlocksPrevious;
headerBits = 0;
+ rawDataBlockLength = rawDataBlockLengthPrevious;
} else {
/* reset hold off frame counter */
hTp->holdOffFrames = 0;