1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-03-10 13:00:08 +01:00

Merge "Reject HE-AAC SBR with a ratio greater than 2:1 and reject USAC streams containing legacy DRC info."

This commit is contained in:
TreeHugger Robot 2020-01-22 23:18:35 +00:00 committed by Android (Google) Code Review
commit 814859ba72

View File

@ -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;
}
}
}