aboutsummaryrefslogtreecommitdiffstats
path: root/libDRCdec/src
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2020-04-17 15:08:00 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2021-01-14 15:32:32 -0800
commit67cae74f74bce961e0812c1743c64df96a3396b7 (patch)
tree1026f4665519e50c01d80d5a3f9177248b75960e /libDRCdec/src
parent9ee8fd55598983e94c56bcaba93820fc0e7da907 (diff)
downloadfdk-aac-67cae74f74bce961e0812c1743c64df96a3396b7.tar.gz
fdk-aac-67cae74f74bce961e0812c1743c64df96a3396b7.tar.bz2
fdk-aac-67cae74f74bce961e0812c1743c64df96a3396b7.zip
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
Diffstat (limited to 'libDRCdec/src')
-rw-r--r--libDRCdec/src/drcDec_reader.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/libDRCdec/src/drcDec_reader.cpp b/libDRCdec/src/drcDec_reader.cpp
index 367a352..b3ec187 100644
--- a/libDRCdec/src/drcDec_reader.cpp
+++ b/libDRCdec/src/drcDec_reader.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
@@ -512,10 +512,13 @@ drcDec_readUniDrcGain(HANDLE_FDK_BITSTREAM hBs,
fMin(tmpNNodes, (UCHAR)16) * sizeof(GAIN_NODE));
}
- hUniDrcGain->uniDrcGainExtPresent = FDKreadBits(hBs, 1);
- if (hUniDrcGain->uniDrcGainExtPresent == 1) {
- err = _readUniDrcGainExtension(hBs, &(hUniDrcGain->uniDrcGainExtension));
- if (err) return err;
+ if (pCoef && (gainSequenceCount ==
+ pCoef->gainSequenceCount)) { /* all sequences have been read */
+ hUniDrcGain->uniDrcGainExtPresent = FDKreadBits(hBs, 1);
+ if (hUniDrcGain->uniDrcGainExtPresent == 1) {
+ err = _readUniDrcGainExtension(hBs, &(hUniDrcGain->uniDrcGainExtension));
+ if (err) return err;
+ }
}
if (err == DE_OK && gainSequenceCount > 0) {