diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2019-11-13 16:10:21 +0100 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2020-01-22 14:13:51 -0800 |
commit | 7388c0732d9cfabd5757f4eda9ea15608a5db126 (patch) | |
tree | 3a9c0e6d7645ded839555a37bcca630f885cff72 | |
parent | cedcc475f52dd704497524dda6ec2ef430d2b6c5 (diff) | |
download | fdk-aac-7388c0732d9cfabd5757f4eda9ea15608a5db126.tar.gz fdk-aac-7388c0732d9cfabd5757f4eda9ea15608a5db126.tar.bz2 fdk-aac-7388c0732d9cfabd5757f4eda9ea15608a5db126.zip |
Reject HE-AAC SBR with a ratio greater than 2:1 and reject USAC streams containing legacy DRC info.
Bug: 146937553
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I1a23d986160c1de07a7159ac026f57d821d3ff1d
-rw-r--r-- | libAACdec/src/aacdecoder.cpp | 39 |
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; + } } } |