Compare commits
3 Commits
86ce199ac8
...
3bdf262068
Author | SHA1 | Date | |
---|---|---|---|
3bdf262068 | |||
c9f34e4656 | |||
fe6c5391a2 |
15
external/toxcore/c-toxcore/toxav/audio.c
vendored
15
external/toxcore/c-toxcore/toxav/audio.c
vendored
@ -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:
|
||||
|
@ -1042,11 +1042,16 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) {
|
||||
|
||||
float fraction = float(total) / total_size;
|
||||
|
||||
char overlay_buf[32];
|
||||
char overlay_buf[64];
|
||||
if (rate > 0.000001f) {
|
||||
const char* byte_suffix = "???";
|
||||
int64_t byte_divider = sizeToHumanReadable(rate, byte_suffix);
|
||||
int64_t seconds_remaining = (total_size - total) / rate;
|
||||
if (seconds_remaining > 0) {
|
||||
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s %lds ", fraction * 100 + 0.01f, rate/byte_divider, byte_suffix, seconds_remaining);
|
||||
} else {
|
||||
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s", fraction * 100 + 0.01f, rate/byte_divider, byte_suffix);
|
||||
}
|
||||
} else {
|
||||
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%%", fraction * 100 + 0.01f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user