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
This commit is contained in:
Fraunhofer IIS FDK 2021-03-16 14:43:32 +01:00 committed by Jean-Michel Trivi
parent cab99f4b6a
commit a1edc32174
1 changed files with 11 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 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten © Copyright 1995 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -961,10 +961,12 @@ SBR_ERROR sbrDecoder_SetParam(HANDLE_SBRDECODER self, const SBRDEC_PARAM param,
/* Set sync state UPSAMPLING for the corresponding slot. /* Set sync state UPSAMPLING for the corresponding slot.
This switches off bitstream parsing until a new header arrives. */ This switches off bitstream parsing until a new header arrives. */
if (hSbrHeader->syncState != SBR_NOT_INITIALIZED) {
hSbrHeader->syncState = UPSAMPLING; hSbrHeader->syncState = UPSAMPLING;
hSbrHeader->status |= SBRDEC_HDR_STAT_UPDATE; hSbrHeader->status |= SBRDEC_HDR_STAT_UPDATE;
} }
} }
}
} break; } break;
case SBR_SKIP_QMF: case SBR_SKIP_QMF:
@ -1371,7 +1373,9 @@ SBR_ERROR sbrDecoder_Parse(HANDLE_SBRDECODER self, HANDLE_FDK_BITSTREAM hBs,
} }
if (headerStatus == HEADER_ERROR) { if (headerStatus == HEADER_ERROR) {
/* Corrupt SBR info data, do not decode and switch to UPSAMPLING */ /* Corrupt SBR info data, do not decode and switch to UPSAMPLING */
hSbrHeader->syncState = UPSAMPLING; hSbrHeader->syncState = hSbrHeader->syncState > UPSAMPLING
? UPSAMPLING
: hSbrHeader->syncState;
fDoDecodeSbrData = 0; fDoDecodeSbrData = 0;
sbrHeaderPresent = 0; sbrHeaderPresent = 0;
} }
@ -1610,8 +1614,10 @@ static SBR_ERROR sbrDecoder_DecodeElement(
/* No valid SBR payload available, hence switch to upsampling (in all /* No valid SBR payload available, hence switch to upsampling (in all
* headers) */ * headers) */
for (hdrIdx = 0; hdrIdx < ((1) + 1); hdrIdx += 1) { for (hdrIdx = 0; hdrIdx < ((1) + 1); hdrIdx += 1) {
if (self->sbrHeader[elementIndex][hdrIdx].syncState > UPSAMPLING) {
self->sbrHeader[elementIndex][hdrIdx].syncState = UPSAMPLING; self->sbrHeader[elementIndex][hdrIdx].syncState = UPSAMPLING;
} }
}
} else { } else {
/* Move frame pointer to the next slot which is up to be decoded/applied /* Move frame pointer to the next slot which is up to be decoded/applied
* next */ * next */