mirror of https://github.com/mstorsjo/fdk-aac.git
Snap for 5936682 from f26eb8af7c
to rvc-release
Change-Id: I5a7309c9ef4f186d05c08f072707ce3e2bf6a9b8
This commit is contained in:
commit
b7cb239980
|
@ -1303,7 +1303,8 @@ static void CAacDecoder_DeInit(HANDLE_AACDECODER self,
|
||||||
const int subStreamIndex) {
|
const int subStreamIndex) {
|
||||||
int ch;
|
int ch;
|
||||||
int aacChannelOffset = 0, aacChannels = (8);
|
int aacChannelOffset = 0, aacChannels = (8);
|
||||||
int numElements = (((8)) + (8)), elementOffset = 0;
|
int numElements = (3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1),
|
||||||
|
elementOffset = 0;
|
||||||
|
|
||||||
if (self == NULL) return;
|
if (self == NULL) return;
|
||||||
|
|
||||||
|
@ -1928,6 +1929,9 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
self->samplingRateInfo[0].samplingRate / self->downscaleFactor;
|
self->samplingRateInfo[0].samplingRate / self->downscaleFactor;
|
||||||
self->streamInfo.aacSamplesPerFrame =
|
self->streamInfo.aacSamplesPerFrame =
|
||||||
asc->m_samplesPerFrame / self->downscaleFactor;
|
asc->m_samplesPerFrame / self->downscaleFactor;
|
||||||
|
if (self->streamInfo.aacSampleRate <= 0) {
|
||||||
|
return AAC_DEC_UNSUPPORTED_SAMPLINGRATE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -1440,7 +1440,8 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc,
|
||||||
UCHAR tmpDownscaleFreqIdx;
|
UCHAR tmpDownscaleFreqIdx;
|
||||||
esc->m_downscaledSamplingFrequency =
|
esc->m_downscaledSamplingFrequency =
|
||||||
getSampleRate(hBs, &tmpDownscaleFreqIdx, 4);
|
getSampleRate(hBs, &tmpDownscaleFreqIdx, 4);
|
||||||
if (esc->m_downscaledSamplingFrequency == 0) {
|
if (esc->m_downscaledSamplingFrequency == 0 ||
|
||||||
|
esc->m_downscaledSamplingFrequency > 96000) {
|
||||||
return TRANSPORTDEC_PARSE_ERROR;
|
return TRANSPORTDEC_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
downscale_fill_nibble = FDKreadBits(hBs, 4);
|
downscale_fill_nibble = FDKreadBits(hBs, 4);
|
||||||
|
@ -1948,6 +1949,9 @@ static TRANSPORTDEC_ERROR UsacConfig_Parse(CSAudioSpecificConfig *asc,
|
||||||
INT nbits = (INT)FDKgetValidBits(hBs);
|
INT nbits = (INT)FDKgetValidBits(hBs);
|
||||||
|
|
||||||
usacSamplingFrequency = getSampleRate(hBs, &asc->m_samplingFrequencyIndex, 5);
|
usacSamplingFrequency = getSampleRate(hBs, &asc->m_samplingFrequencyIndex, 5);
|
||||||
|
if (usacSamplingFrequency == 0 || usacSamplingFrequency > 96000) {
|
||||||
|
return TRANSPORTDEC_PARSE_ERROR;
|
||||||
|
}
|
||||||
asc->m_samplingFrequency = (UINT)usacSamplingFrequency;
|
asc->m_samplingFrequency = (UINT)usacSamplingFrequency;
|
||||||
|
|
||||||
coreSbrFrameLengthIndex = FDKreadBits(hBs, 3);
|
coreSbrFrameLengthIndex = FDKreadBits(hBs, 3);
|
||||||
|
@ -2027,7 +2031,8 @@ static TRANSPORTDEC_ERROR AudioSpecificConfig_ExtensionParse(
|
||||||
self->m_extensionSamplingFrequency = getSampleRate(
|
self->m_extensionSamplingFrequency = getSampleRate(
|
||||||
bs, &self->m_extensionSamplingFrequencyIndex, 4);
|
bs, &self->m_extensionSamplingFrequencyIndex, 4);
|
||||||
|
|
||||||
if ((INT)self->m_extensionSamplingFrequency <= 0) {
|
if (self->m_extensionSamplingFrequency == 0 ||
|
||||||
|
self->m_extensionSamplingFrequency > 96000) {
|
||||||
return TRANSPORTDEC_PARSE_ERROR;
|
return TRANSPORTDEC_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2153,6 +2158,10 @@ TRANSPORTDEC_ERROR AudioSpecificConfig_Parse(
|
||||||
|
|
||||||
self->m_extensionSamplingFrequency =
|
self->m_extensionSamplingFrequency =
|
||||||
getSampleRate(bs, &self->m_extensionSamplingFrequencyIndex, 4);
|
getSampleRate(bs, &self->m_extensionSamplingFrequencyIndex, 4);
|
||||||
|
if (self->m_extensionSamplingFrequency == 0 ||
|
||||||
|
self->m_extensionSamplingFrequency > 96000) {
|
||||||
|
return TRANSPORTDEC_PARSE_ERROR;
|
||||||
|
}
|
||||||
self->m_aot = getAOT(bs);
|
self->m_aot = getAOT(bs);
|
||||||
|
|
||||||
switch (self->m_aot) {
|
switch (self->m_aot) {
|
||||||
|
|
|
@ -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 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -663,10 +663,14 @@ TRANSPORTDEC_ERROR transportDec_FillData(const HANDLE_TRANSPORTDEC hTp,
|
||||||
if (*pBytesValid == 0) {
|
if (*pBytesValid == 0) {
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return TRANSPORTDEC_OK;
|
return TRANSPORTDEC_OK;
|
||||||
}
|
} else {
|
||||||
|
const int bytesValid = *pBytesValid;
|
||||||
if (hTp->numberOfRawDataBlocks <= 0) {
|
|
||||||
FDKfeedBuffer(hBs, pBuffer, bufferSize, pBytesValid);
|
FDKfeedBuffer(hBs, pBuffer, bufferSize, pBytesValid);
|
||||||
|
|
||||||
|
if (hTp->numberOfRawDataBlocks > 0) {
|
||||||
|
hTp->globalFramePos += (bytesValid - *pBytesValid) * 8;
|
||||||
|
hTp->accessUnitAnchor[layer] = FDKgetValidBits(hBs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1151,6 +1155,11 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
|
||||||
&rawDataBlockLength, &fTraverseMoreFrames,
|
&rawDataBlockLength, &fTraverseMoreFrames,
|
||||||
&syncLayerFrameBits, &fConfigFound,
|
&syncLayerFrameBits, &fConfigFound,
|
||||||
&headerBits);
|
&headerBits);
|
||||||
|
if (headerBits > bitsAvail) {
|
||||||
|
err = (headerBits < (INT)hBs->hBitBuf.bufBits)
|
||||||
|
? TRANSPORTDEC_NOT_ENOUGH_BITS
|
||||||
|
: TRANSPORTDEC_SYNC_ERROR;
|
||||||
|
}
|
||||||
if (TPDEC_IS_FATAL_ERROR(err)) {
|
if (TPDEC_IS_FATAL_ERROR(err)) {
|
||||||
/* Rewind - TPDEC_SYNCSKIP, in order to look for a synch one bit ahead
|
/* Rewind - TPDEC_SYNCSKIP, in order to look for a synch one bit ahead
|
||||||
* next time. Ensure that the bit amount lands at a multiple of
|
* next time. Ensure that the bit amount lands at a multiple of
|
||||||
|
@ -1181,8 +1190,6 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == TRANSPORTDEC_NOT_ENOUGH_BITS) {
|
if (err == TRANSPORTDEC_NOT_ENOUGH_BITS) {
|
||||||
/* Enforce reading of new data */
|
|
||||||
hTp->numberOfRawDataBlocks = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,7 +1280,9 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
|
||||||
/* Rewind for retry because of not enough bits */
|
/* Rewind for retry because of not enough bits */
|
||||||
if (err == TRANSPORTDEC_NOT_ENOUGH_BITS) {
|
if (err == TRANSPORTDEC_NOT_ENOUGH_BITS) {
|
||||||
FDKpushBack(hBs, headerBits);
|
FDKpushBack(hBs, headerBits);
|
||||||
|
hTp->numberOfRawDataBlocks = numRawDataBlocksPrevious;
|
||||||
headerBits = 0;
|
headerBits = 0;
|
||||||
|
rawDataBlockLength = rawDataBlockLengthPrevious;
|
||||||
} else {
|
} else {
|
||||||
/* reset hold off frame counter */
|
/* reset hold off frame counter */
|
||||||
hTp->holdOffFrames = 0;
|
hTp->holdOffFrames = 0;
|
||||||
|
|
Loading…
Reference in New Issue