Compare commits

..

3 Commits

Author SHA1 Message Date
3bdf262068
give raw time remaining estimate based on rate
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
2024-09-24 12:05:29 +02:00
c9f34e4656
update toxcore Merge commit 'fe6c5391a2272681261b85faf352728b15774ef4' 2024-09-22 12:48:22 +02:00
fe6c5391a2 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
2024-09-22 12:48:22 +02:00
2 changed files with 22 additions and 2 deletions

View File

@ -377,6 +377,21 @@ static OpusEncoder *create_audio_encoder(const Logger *log, uint32_t bit_rate, u
goto FAILURE; 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. * Configures the encoder's use of inband forward error correction.
* Note: * Note:

View File

@ -1042,11 +1042,16 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) {
float fraction = float(total) / total_size; float fraction = float(total) / total_size;
char overlay_buf[32]; char overlay_buf[64];
if (rate > 0.000001f) { if (rate > 0.000001f) {
const char* byte_suffix = "???"; const char* byte_suffix = "???";
int64_t byte_divider = sizeToHumanReadable(rate, 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); std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s", fraction * 100 + 0.01f, rate/byte_divider, byte_suffix);
}
} else { } else {
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%%", fraction * 100 + 0.01f); std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%%", fraction * 100 + 0.01f);
} }