Squashed 'external/toxcore/c-toxcore/' changes from 671b1f92332..03e9fbf3703

03e9fbf3703 fix: Use Opus in the CBR mode

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: 03e9fbf3703e430d21138c4f69e9ac7dbefb7564
This commit is contained in:
Green Sky 2024-09-22 12:48:22 +02:00
parent fd4c16d090
commit fe6c5391a2

View File

@ -377,6 +377,21 @@ static OpusEncoder *create_audio_encoder(const Logger *log, uint32_t bit_rate, u
goto FAILURE;
}
/*
* The libopus library defaults to VBR, which is unsafe in any VoIP environment
* (see for example doi:10.1109/SP.2011.34). Switching to CBR very slightly
* decreases audio quality at lower bitrates.
*
* Parameters:
* `[in]` `x` `opus_int32`: Whether to use VBR mode, 1 (VBR) is default
*/
status = opus_encoder_ctl(rc, OPUS_SET_VBR(0));
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while setting encoder ctl: %s", opus_strerror(status));
goto FAILURE;
}
/*
* Configures the encoder's use of inband forward error correction.
* Note: