aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-01-22 23:18:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-22 23:18:35 +0000
commit814859ba721691e2624bdf6d86eccc4ca10ffc0e (patch)
treec7dc2d0521a4137dc87ac83f32b43312ebc3b4df
parent44b9543d921d899e2edae88dea9e2566fed861f0 (diff)
parent7388c0732d9cfabd5757f4eda9ea15608a5db126 (diff)
downloadfdk-aac-814859ba721691e2624bdf6d86eccc4ca10ffc0e.tar.gz
fdk-aac-814859ba721691e2624bdf6d86eccc4ca10ffc0e.tar.bz2
fdk-aac-814859ba721691e2624bdf6d86eccc4ca10ffc0e.zip
Merge "Reject HE-AAC SBR with a ratio greater than 2:1 and reject USAC streams containing legacy DRC info."
-rw-r--r--libAACdec/src/aacdecoder.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp
index 6b5a86c..bd12d96 100644
--- a/libAACdec/src/aacdecoder.cpp
+++ b/libAACdec/src/aacdecoder.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
@@ -1848,6 +1848,12 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
self->streamInfo.extSamplingRate / self->downscaleFactor;
}
}
+ if ((asc->m_aot == AOT_AAC_LC) && (asc->m_sbrPresentFlag == 1) &&
+ (asc->m_extensionSamplingFrequency > (2 * asc->m_samplingFrequency))) {
+ return AAC_DEC_UNSUPPORTED_SAMPLINGRATE; /* Core decoder supports at most a
+ 1:2 upsampling for HE-AAC and
+ HE-AACv2 */
+ }
/* --------- vcb11 ------------ */
self->flags[streamIndex] |= (asc->m_vcb11Flag) ? AC_ER_VCB11 : 0;
@@ -2366,6 +2372,13 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
goto bail;
}
+ if (*configChanged) {
+ if (asc->m_aot == AOT_USAC) {
+ self->hDrcInfo->enable = 0;
+ self->hDrcInfo->progRefLevelPresent = 0;
+ }
+ }
+
if (asc->m_aot == AOT_USAC) {
pcmLimiter_SetAttack(self->hLimiter, (5));
pcmLimiter_SetThreshold(self->hLimiter, FL2FXCONST_DBL(0.89125094f));
@@ -3172,9 +3185,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
pce->ElementInstanceTag, drcChMap, aacChannels);
if (mapped > 0) {
- /* If at least one DRC thread has been mapped to a channel threre was DRC
- * data in the bitstream. */
- self->flags[streamIndex] |= AC_DRC_PRESENT;
+ if (!(self->flags[streamIndex] & (AC_USAC | AC_RSV603DA))) {
+ /* If at least one DRC thread has been mapped to a channel there was DRC
+ * data in the bitstream. */
+ self->flags[streamIndex] |= AC_DRC_PRESENT;
+ } else {
+ self->hDrcInfo->enable = 0;
+ self->hDrcInfo->progRefLevelPresent = 0;
+ ErrorStatus = AAC_DEC_UNSUPPORTED_FORMAT;
+ }
}
/* Create a reverse mapping table */
@@ -3419,9 +3438,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
pce->ElementInstanceTag, drcChMap, aacChannels);
if (mapped > 0) {
- /* If at least one DRC thread has been mapped to a channel threre was DRC
- * data in the bitstream. */
- self->flags[streamIndex] |= AC_DRC_PRESENT;
+ if (!(self->flags[streamIndex] & (AC_USAC | AC_RSV603DA))) {
+ /* If at least one DRC thread has been mapped to a channel there was DRC
+ * data in the bitstream. */
+ self->flags[streamIndex] |= AC_DRC_PRESENT;
+ } else {
+ self->hDrcInfo->enable = 0;
+ self->hDrcInfo->progRefLevelPresent = 0;
+ ErrorStatus = AAC_DEC_UNSUPPORTED_FORMAT;
+ }
}
}