Read uniDrcGainExtension element only if all DRC gain sequences are parsed correctly.

Prevent error return during parsing of incomplete uniDrcGain() element. This fixes unnecessary concealment of frames for AAC in case a uniDrcGain() is provided, but the uniDrcConfig() element is not available.

Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: I5ae343eaea481774c53240dbce4da0f4ff06cd1d
This commit is contained in:
Fraunhofer IIS FDK 2020-04-17 15:08:00 +02:00 committed by Ray Essick
parent 5e031b67ba
commit 0c2c08aef6
1 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android 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. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -512,11 +512,14 @@ drcDec_readUniDrcGain(HANDLE_FDK_BITSTREAM hBs,
fMin(tmpNNodes, (UCHAR)16) * sizeof(GAIN_NODE)); fMin(tmpNNodes, (UCHAR)16) * sizeof(GAIN_NODE));
} }
if (pCoef && (gainSequenceCount ==
pCoef->gainSequenceCount)) { /* all sequences have been read */
hUniDrcGain->uniDrcGainExtPresent = FDKreadBits(hBs, 1); hUniDrcGain->uniDrcGainExtPresent = FDKreadBits(hBs, 1);
if (hUniDrcGain->uniDrcGainExtPresent == 1) { if (hUniDrcGain->uniDrcGainExtPresent == 1) {
err = _readUniDrcGainExtension(hBs, &(hUniDrcGain->uniDrcGainExtension)); err = _readUniDrcGainExtension(hBs, &(hUniDrcGain->uniDrcGainExtension));
if (err) return err; if (err) return err;
} }
}
if (err == DE_OK && gainSequenceCount > 0) { if (err == DE_OK && gainSequenceCount > 0) {
hUniDrcGain->status = 1; hUniDrcGain->status = 1;