Issue #1890 - Update libopus

This resolves #1890
This commit is contained in:
Moonchild 2022-05-04 17:03:37 +00:00 • committed by roytam1
commit a8b1099a1e
228 changed files with 10990 additions and 5670 deletions

View file

@ -39,9 +39,15 @@ opus_int silk_control_audio_bandwidth(
)
{
opus_int fs_kHz;
opus_int orig_kHz;
opus_int32 fs_Hz;
fs_kHz = psEncC->fs_kHz;
orig_kHz = psEncC->fs_kHz;
/* Handle a bandwidth-switching reset where we need to be aware what the last sampling rate was. */
if( orig_kHz == 0 ) {
orig_kHz = psEncC->sLP.saved_fs_kHz;
}
fs_kHz = orig_kHz;
fs_Hz = silk_SMULBB( fs_kHz, 1000 );
if( fs_Hz == 0 ) {
/* Encoder has just been initialized */
@ -61,7 +67,7 @@ opus_int silk_control_audio_bandwidth(
}
if( psEncC->allow_bandwidth_switch || encControl->opusCanSwitch ) {
/* Check if we should switch down */
if( silk_SMULBB( psEncC->fs_kHz, 1000 ) > psEncC->desiredInternal_fs_Hz )
if( silk_SMULBB( orig_kHz, 1000 ) > psEncC->desiredInternal_fs_Hz )
{
/* Switch down */
if( psEncC->sLP.mode == 0 ) {
@ -76,7 +82,7 @@ opus_int silk_control_audio_bandwidth(
psEncC->sLP.mode = 0;
/* Switch to a lower sample frequency */
fs_kHz = psEncC->fs_kHz == 16 ? 12 : 8;
fs_kHz = orig_kHz == 16 ? 12 : 8;
} else {
if( psEncC->sLP.transition_frame_no <= 0 ) {
encControl->switchReady = 1;
@ -90,12 +96,12 @@ opus_int silk_control_audio_bandwidth(
}
else
/* Check if we should switch up */
if( silk_SMULBB( psEncC->fs_kHz, 1000 ) < psEncC->desiredInternal_fs_Hz )
if( silk_SMULBB( orig_kHz, 1000 ) < psEncC->desiredInternal_fs_Hz )
{
/* Switch up */
if( encControl->opusCanSwitch ) {
/* Switch to a higher sample frequency */
fs_kHz = psEncC->fs_kHz == 8 ? 12 : 16;
fs_kHz = orig_kHz == 8 ? 12 : 16;
/* New transition */
psEncC->sLP.transition_frame_no = 0;