From a3d11689433a046ad57add8ea22dedceb2fe722d Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 18 Aug 2017 22:37:30 +0300 Subject: Adjust the fix for infinite loops with a drained ADTS stream This should have less risk of causing other issues. --- libMpegTPDec/src/tpdec_lib.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libMpegTPDec') diff --git a/libMpegTPDec/src/tpdec_lib.cpp b/libMpegTPDec/src/tpdec_lib.cpp index 09f0703..5760752 100644 --- a/libMpegTPDec/src/tpdec_lib.cpp +++ b/libMpegTPDec/src/tpdec_lib.cpp @@ -342,7 +342,9 @@ TRANSPORTDEC_ERROR transportDec_FillData( } } else { /* ... else feed bitbuffer with new stream data (append). */ - FDKfeedBuffer (hBs, pBuffer, bufferSize, pBytesValid); + if ((hTp->numberOfRawDataBlocks <= 0) || (FDKgetValidBits(hBs)==0)) { + FDKfeedBuffer (hBs, pBuffer, bufferSize, pBytesValid) ; + } } return TRANSPORTDEC_OK; -- cgit v1.2.3