aboutsummaryrefslogtreecommitdiffstats
path: root/libSACdec
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2020-04-09 17:58:17 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2020-12-28 09:21:16 -0800
commit5eb9ed1b1fe94e8bf94bba4aa305b61db19b48c5 (patch)
tree54d9ad0b41c5d7eecfb60c9c4b2fa53027f1116e /libSACdec
parentd6a7375bfa25ebcdd47900e5f32958c6c8deb57f (diff)
downloadfdk-aac-5eb9ed1b1fe94e8bf94bba4aa305b61db19b48c5.tar.gz
fdk-aac-5eb9ed1b1fe94e8bf94bba4aa305b61db19b48c5.tar.bz2
fdk-aac-5eb9ed1b1fe94e8bf94bba4aa305b61db19b48c5.zip
Check number of core channels and SAC decoder input channels to avoid a channel mismatch.
Bug: 176246647 Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc Change-Id: Ib8b6973e9c29e13b8ef33d7736be2b977928face
Diffstat (limited to 'libSACdec')
-rw-r--r--libSACdec/include/sac_dec_lib.h6
-rw-r--r--libSACdec/src/sac_dec.cpp14
-rw-r--r--libSACdec/src/sac_dec_lib.cpp21
3 files changed, 29 insertions, 12 deletions
diff --git a/libSACdec/include/sac_dec_lib.h b/libSACdec/include/sac_dec_lib.h
index 1827504..5aad4e0 100644
--- a/libSACdec/include/sac_dec_lib.h
+++ b/libSACdec/include/sac_dec_lib.h
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -316,8 +316,8 @@ SACDEC_ERROR mpegSurroundDecoder_Init(
SACDEC_ERROR mpegSurroundDecoder_Config(
CMpegSurroundDecoder *pMpegSurroundDecoder, HANDLE_FDK_BITSTREAM hBs,
AUDIO_OBJECT_TYPE coreCodec, INT samplingRate, INT frameSize,
- INT stereoConfigIndex, INT coreSbrFrameLengthIndex, INT configBytes,
- const UCHAR configMode, UCHAR *configChanged);
+ INT numChannels, INT stereoConfigIndex, INT coreSbrFrameLengthIndex,
+ INT configBytes, const UCHAR configMode, UCHAR *configChanged);
SACDEC_ERROR
mpegSurroundDecoder_ConfigureQmfDomain(
diff --git a/libSACdec/src/sac_dec.cpp b/libSACdec/src/sac_dec.cpp
index f0d24fb..a26e251 100644
--- a/libSACdec/src/sac_dec.cpp
+++ b/libSACdec/src/sac_dec.cpp
@@ -1209,15 +1209,17 @@ static SACDEC_ERROR SpatialDecApplyParameterSets(
self->bShareDelayWithSBR = 0; /* We got no hybrid delay */
else
self->bShareDelayWithSBR = 1;
- SpatialDecFeedQMF(self, qmfInDataReal, qmfInDataImag, ts_io, bypassMode,
- self->qmfInputReal__FDK, self->qmfInputImag__FDK,
- self->numInputChannels);
+ SpatialDecFeedQMF(
+ self, qmfInDataReal, qmfInDataImag, ts_io, bypassMode,
+ self->qmfInputReal__FDK, self->qmfInputImag__FDK,
+ (bypassMode) ? numInputChannels : self->numInputChannels);
break;
case INPUTMODE_TIME:
self->bShareDelayWithSBR = 0;
- SpatialDecQMFAnalysis(self, inData, ts_io, bypassMode,
- self->qmfInputReal__FDK, self->qmfInputImag__FDK,
- self->numInputChannels);
+ SpatialDecQMFAnalysis(
+ self, inData, ts_io, bypassMode, self->qmfInputReal__FDK,
+ self->qmfInputImag__FDK,
+ (bypassMode) ? numInputChannels : self->numInputChannels);
break;
default:
break;
diff --git a/libSACdec/src/sac_dec_lib.cpp b/libSACdec/src/sac_dec_lib.cpp
index 57446f8..d30131f 100644
--- a/libSACdec/src/sac_dec_lib.cpp
+++ b/libSACdec/src/sac_dec_lib.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -700,9 +700,10 @@ bail:
SACDEC_ERROR mpegSurroundDecoder_Config(
CMpegSurroundDecoder *pMpegSurroundDecoder, HANDLE_FDK_BITSTREAM hBs,
AUDIO_OBJECT_TYPE coreCodec, INT samplingRate, INT frameSize,
- INT stereoConfigIndex, INT coreSbrFrameLengthIndex, INT configBytes,
- const UCHAR configMode, UCHAR *configChanged) {
+ INT numChannels, INT stereoConfigIndex, INT coreSbrFrameLengthIndex,
+ INT configBytes, const UCHAR configMode, UCHAR *configChanged) {
SACDEC_ERROR err = MPS_OK;
+ INT nInputChannels;
SPATIAL_SPECIFIC_CONFIG spatialSpecificConfig;
SPATIAL_SPECIFIC_CONFIG *pSsc =
&pMpegSurroundDecoder->spatialSpecificConfigBackup;
@@ -716,12 +717,18 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
err = SpatialDecParseMps212Config(
hBs, &spatialSpecificConfig, samplingRate, coreCodec,
stereoConfigIndex, coreSbrFrameLengthIndex);
+ nInputChannels = spatialSpecificConfig.nInputChannels;
pSsc = &spatialSpecificConfig;
} else {
err = SpatialDecParseMps212Config(
hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup,
samplingRate, coreCodec, stereoConfigIndex,
coreSbrFrameLengthIndex);
+ nInputChannels =
+ pMpegSurroundDecoder->spatialSpecificConfigBackup.nInputChannels;
+ }
+ if ((err == MPS_OK) && (numChannels != nInputChannels)) {
+ err = MPS_PARSE_ERROR;
}
break;
case AOT_ER_AAC_ELD:
@@ -731,11 +738,19 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
* into temporarily allocated structure */
err = SpatialDecParseSpecificConfig(hBs, &spatialSpecificConfig,
configBytes, coreCodec);
+ nInputChannels = spatialSpecificConfig.nInputChannels;
pSsc = &spatialSpecificConfig;
} else {
err = SpatialDecParseSpecificConfig(
hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup,
configBytes, coreCodec);
+ nInputChannels =
+ pMpegSurroundDecoder->spatialSpecificConfigBackup.nInputChannels;
+ }
+ /* check number of channels for channel_configuration > 0 */
+ if ((err == MPS_OK) && (numChannels > 0) &&
+ (numChannels != nInputChannels)) {
+ err = MPS_PARSE_ERROR;
}
break;
default: