aboutsummaryrefslogtreecommitdiffstats
path: root/libMpegTPDec/src/tpdec_latm.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2013-08-27 16:28:09 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2013-08-27 16:28:09 -0700
commit5016eb7f6582fbb2d72d79be782325a12df08864 (patch)
treebc2325ebc6840a20d25f35a0c5a6a13454d2e402 /libMpegTPDec/src/tpdec_latm.cpp
parentb9774f90651be61065ae40171fc321f6ced60e49 (diff)
downloadfdk-aac-dabplus-5016eb7f6582fbb2d72d79be782325a12df08864.tar.gz
fdk-aac-dabplus-5016eb7f6582fbb2d72d79be782325a12df08864.tar.bz2
fdk-aac-dabplus-5016eb7f6582fbb2d72d79be782325a12df08864.zip
Decoder stability, sanity checks improvements
* AAC-Decoder - Improved PCE handling for saver (re-)configuration and metadata processing. Modified file(s): libAACdec/src/aacdecoder.cpp libAACdec/src/aacdecoder_lib.cpp - Transport layer changes (config found) -> to be evaluated. Modified file(s): libMpegTPDec/include/tpdec_lib.h libMpegTPDec/src/tpdec_latm.h libMpegTPDec/src/version libMpegTPDec/src/tpdec_asc.cpp libMpegTPDec/src/tpdec_lib.cpp libMpegTPDec/src/tpdec_adts.cpp libMpegTPDec/src/tpdec_latm.cpp libSYS/include/FDK_audio.h libSYS/src/genericStds.cpp - Enable concealment state machine to skip states if the corresponding parameter is set to zero. Modified file(s): libAACdec/src/conceal.cpp - Add some more sanity checks to avoid segmentation faults especially when setting dynamic API params. Modified file(s): libAACdec/src/aacdecoder_lib.cpp - Fix to do a fail-safe initialization of IMDCT for all channels even with corrupt streams. Modified file(s): libAACdec/src/aacdecoder.cpp - HCR decoder fix (remove warnings). Modified file(s): libAACdec/src/block.cpp - Fix border calculation in SBR decoder's LPP transposer patch determination. Modified file(s): libSBRdec/src/env_dec.cpp libSBRdec/src/sbrdecoder.cpp libSBRdec/src/lpp_tran.cpp Bug 9428126 Change-Id: Ib415b702b88a7ec8e9a55789d79cafb39296d26b
Diffstat (limited to 'libMpegTPDec/src/tpdec_latm.cpp')
-rw-r--r--libMpegTPDec/src/tpdec_latm.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/libMpegTPDec/src/tpdec_latm.cpp b/libMpegTPDec/src/tpdec_latm.cpp
index 7595c5e..5710d77 100644
--- a/libMpegTPDec/src/tpdec_latm.cpp
+++ b/libMpegTPDec/src/tpdec_latm.cpp
@@ -120,7 +120,8 @@ TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
CLatmDemux *pLatmDemux,
int m_muxConfigPresent,
CSTpCallBacks *pTpDecCallbacks,
- CSAudioSpecificConfig *pAsc
+ CSAudioSpecificConfig *pAsc,
+ int *pfConfigFound
)
{
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
@@ -129,12 +130,17 @@ TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
pLatmDemux->m_useSameStreamMux = FDKreadBits(bs,1);
if (!pLatmDemux->m_useSameStreamMux) {
- if ((ErrorStatus = CLatmDemux_ReadStreamMuxConfig(bs, pLatmDemux, pTpDecCallbacks, pAsc))) {
+ if ((ErrorStatus = CLatmDemux_ReadStreamMuxConfig(bs, pLatmDemux, pTpDecCallbacks, pAsc, pfConfigFound))) {
return (ErrorStatus);
}
}
}
+ /* If there was no configuration read, its not possible to parse PayloadLengthInfo below. */
+ if (! *pfConfigFound) {
+ return TRANSPORTDEC_SYNC_ERROR;
+ }
+
if (pLatmDemux->m_AudioMuxVersionA == 0) {
/* Do only once per call, because parsing and decoding is done in-line. */
if ((ErrorStatus = CLatmDemux_ReadPayloadLengthInfo(bs,pLatmDemux))) {
@@ -154,6 +160,7 @@ TRANSPORTDEC_ERROR CLatmDemux_Read(
TRANSPORT_TYPE tt,
CSTpCallBacks *pTpDecCallbacks,
CSAudioSpecificConfig *pAsc,
+ int *pfConfigFound,
const INT ignoreBufferFullness
)
{
@@ -168,7 +175,7 @@ TRANSPORTDEC_ERROR CLatmDemux_Read(
return TRANSPORTDEC_NOT_ENOUGH_BITS;
}
- if ((ErrorStatus = CLatmDemux_ReadAudioMuxElement(bs, pLatmDemux, (tt != TT_MP4_LATM_MCP0), pTpDecCallbacks, pAsc)))
+ if ((ErrorStatus = CLatmDemux_ReadAudioMuxElement(bs, pLatmDemux, (tt != TT_MP4_LATM_MCP0), pTpDecCallbacks, pAsc, pfConfigFound)))
return (ErrorStatus);
if (!ignoreBufferFullness)
@@ -205,7 +212,8 @@ TRANSPORTDEC_ERROR CLatmDemux_ReadStreamMuxConfig(
HANDLE_FDK_BITSTREAM bs,
CLatmDemux *pLatmDemux,
CSTpCallBacks *pTpDecCallbacks,
- CSAudioSpecificConfig *pAsc
+ CSAudioSpecificConfig *pAsc,
+ int * pfConfigFound
)
{
LATM_LAYER_INFO *p_linfo = NULL;
@@ -272,6 +280,7 @@ TRANSPORTDEC_ERROR CLatmDemux_ReadStreamMuxConfig(
if ((ErrorStatus = AudioSpecificConfig_Parse(&pAsc[TPDEC_TRACKINDEX(prog,lay)], &tmpBs, 1, pTpDecCallbacks))) {
return (ErrorStatus);
}
+ *pfConfigFound = 1;
/* The field p_linfo->m_ascLen could be wrong, so check if */
if ( 0 > (INT)FDKgetValidBits(&tmpBs)) {
@@ -292,6 +301,7 @@ TRANSPORTDEC_ERROR CLatmDemux_ReadStreamMuxConfig(
if (cbError != 0) {
return TRANSPORTDEC_UNKOWN_ERROR;
}
+ *pfConfigFound = 1;
}
}
@@ -377,7 +387,7 @@ TRANSPORTDEC_ERROR CLatmDemux_ReadPayloadLengthInfo(HANDLE_FDK_BITSTREAM bs, CLa
else {
ErrorStatus = TRANSPORTDEC_PARSE_ERROR; //AAC_DEC_LATM_TIMEFRAMING;
}
- if (pLatmDemux->m_audioMuxLengthBytes > 0 && totalPayloadBits > pLatmDemux->m_audioMuxLengthBytes*8) {
+ if (pLatmDemux->m_audioMuxLengthBytes > (UINT)0 && totalPayloadBits > (int)pLatmDemux->m_audioMuxLengthBytes*8) {
return TRANSPORTDEC_PARSE_ERROR;
}
return (ErrorStatus);