summaryrefslogtreecommitdiffstats
path: root/libMpegTPDec/src/tpdec_latm.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2013-11-01 10:46:40 +0200
committerMartin Storsjo <martin@martin.st>2013-11-01 10:46:40 +0200
commit321233ee92e138f44294c7bb9a375eadad9d24fa (patch)
tree1de928ad26325302f64c56603157f50095dcf2b1 /libMpegTPDec/src/tpdec_latm.cpp
parentfcb5f1b692cb8343de35e69f9084328c652cf690 (diff)
parentfa3eba16446cc8f2f5e2dfc20d86a49dbd37299e (diff)
downloadODR-AudioEnc-321233ee92e138f44294c7bb9a375eadad9d24fa.tar.gz
ODR-AudioEnc-321233ee92e138f44294c7bb9a375eadad9d24fa.tar.bz2
ODR-AudioEnc-321233ee92e138f44294c7bb9a375eadad9d24fa.zip
Merge remote-tracking branch 'aosp/kitkat-release' into kitkat-merge
Conflicts: libAACenc/src/quantize.cpp
Diffstat (limited to 'libMpegTPDec/src/tpdec_latm.cpp')
-rw-r--r--libMpegTPDec/src/tpdec_latm.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/libMpegTPDec/src/tpdec_latm.cpp b/libMpegTPDec/src/tpdec_latm.cpp
index 99b905c..5710d77 100644
--- a/libMpegTPDec/src/tpdec_latm.cpp
+++ b/libMpegTPDec/src/tpdec_latm.cpp
@@ -2,7 +2,7 @@
/* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
All rights reserved.
1. INTRODUCTION
@@ -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);