aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2021-03-16 14:43:32 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2021-04-29 13:02:01 -0700
commita1edc32174933c375f84f202dddadd5dfb862060 (patch)
treeabbd6a7f0b661cfbdc2eda6411578d68590dbbbd /libSBRdec
parentcab99f4b6a45de02a3b6d010cef4443a4a249f88 (diff)
downloadfdk-aac-a1edc32174933c375f84f202dddadd5dfb862060.tar.gz
fdk-aac-a1edc32174933c375f84f202dddadd5dfb862060.tar.bz2
fdk-aac-a1edc32174933c375f84f202dddadd5dfb862060.zip
Sbr syncstate may only be set to upsampling if the sbr decoder was sucessfully initialized.
Bug: 186777497 Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc Change-Id: I92f7c559af961ec063bfea74353f11092dcda653
Diffstat (limited to 'libSBRdec')
-rw-r--r--libSBRdec/src/sbrdecoder.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp
index b101a4a..7718695 100644
--- a/libSBRdec/src/sbrdecoder.cpp
+++ b/libSBRdec/src/sbrdecoder.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -961,8 +961,10 @@ SBR_ERROR sbrDecoder_SetParam(HANDLE_SBRDECODER self, const SBRDEC_PARAM param,
/* Set sync state UPSAMPLING for the corresponding slot.
This switches off bitstream parsing until a new header arrives. */
- hSbrHeader->syncState = UPSAMPLING;
- hSbrHeader->status |= SBRDEC_HDR_STAT_UPDATE;
+ if (hSbrHeader->syncState != SBR_NOT_INITIALIZED) {
+ hSbrHeader->syncState = UPSAMPLING;
+ hSbrHeader->status |= SBRDEC_HDR_STAT_UPDATE;
+ }
}
}
} break;
@@ -1371,7 +1373,9 @@ SBR_ERROR sbrDecoder_Parse(HANDLE_SBRDECODER self, HANDLE_FDK_BITSTREAM hBs,
}
if (headerStatus == HEADER_ERROR) {
/* Corrupt SBR info data, do not decode and switch to UPSAMPLING */
- hSbrHeader->syncState = UPSAMPLING;
+ hSbrHeader->syncState = hSbrHeader->syncState > UPSAMPLING
+ ? UPSAMPLING
+ : hSbrHeader->syncState;
fDoDecodeSbrData = 0;
sbrHeaderPresent = 0;
}
@@ -1610,7 +1614,9 @@ static SBR_ERROR sbrDecoder_DecodeElement(
/* No valid SBR payload available, hence switch to upsampling (in all
* headers) */
for (hdrIdx = 0; hdrIdx < ((1) + 1); hdrIdx += 1) {
- self->sbrHeader[elementIndex][hdrIdx].syncState = UPSAMPLING;
+ if (self->sbrHeader[elementIndex][hdrIdx].syncState > UPSAMPLING) {
+ self->sbrHeader[elementIndex][hdrIdx].syncState = UPSAMPLING;
+ }
}
} else {
/* Move frame pointer to the next slot which is up to be decoded/applied