ft duration human readable
Some checks are pending
ContinuousDelivery / linux-ubuntu (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / linux (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run
Some checks are pending
ContinuousDelivery / linux-ubuntu (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / linux (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run
lower video bitrate to 1400kbits
This commit is contained in:
parent
2d54a3111c
commit
5708a83ba6
@ -94,6 +94,45 @@ static int64_t sizeToHumanReadable(int64_t file_size, const char*& suffix_out) {
|
|||||||
return (divider > 1024) ? (divider / 1024) : 1;
|
return (divider > 1024) ? (divider / 1024) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns divider and places static suffix string into suffix_out
|
||||||
|
static int64_t durationToHumanReadable(int64_t t, const char*& suffix_out) {
|
||||||
|
static const char* suffix_arr[] {
|
||||||
|
"ms",
|
||||||
|
"s",
|
||||||
|
"min",
|
||||||
|
"h",
|
||||||
|
"d",
|
||||||
|
"a",
|
||||||
|
};
|
||||||
|
static const int64_t divider_arr[] {
|
||||||
|
1000, // ms -> s
|
||||||
|
60, // s -> min
|
||||||
|
60, // min -> h
|
||||||
|
24, // h -> d
|
||||||
|
256, // d -> a // aprox
|
||||||
|
};
|
||||||
|
|
||||||
|
if (t <= 0) {
|
||||||
|
suffix_out = suffix_arr[0];
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t divider {1};
|
||||||
|
for (size_t i = 0; i < std::size(divider_arr); i++) {
|
||||||
|
if (t < divider * divider_arr[i]) {
|
||||||
|
suffix_out = suffix_arr[i];
|
||||||
|
return divider;
|
||||||
|
}
|
||||||
|
|
||||||
|
divider *= divider_arr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we are here, we are in the last element
|
||||||
|
// 5 and 4
|
||||||
|
suffix_out = suffix_arr[5];
|
||||||
|
return divider;
|
||||||
|
}
|
||||||
|
|
||||||
static std::string file_path_url_escape(const std::string&& value) {
|
static std::string file_path_url_escape(const std::string&& value) {
|
||||||
std::ostringstream escaped;
|
std::ostringstream escaped;
|
||||||
|
|
||||||
@ -1145,13 +1184,25 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) {
|
|||||||
|
|
||||||
float fraction = float(transfer_total) / total_size;
|
float fraction = float(transfer_total) / total_size;
|
||||||
|
|
||||||
char overlay_buf[64];
|
char overlay_buf[128];
|
||||||
if (transfer_rate > 0.000001f) {
|
if (transfer_rate > 0.000001f) {
|
||||||
const char* byte_suffix = "???";
|
const char* byte_suffix = "???";
|
||||||
int64_t byte_divider = sizeToHumanReadable(transfer_rate, byte_suffix);
|
int64_t byte_divider = sizeToHumanReadable(transfer_rate, byte_suffix);
|
||||||
int64_t seconds_remaining = (total_size - transfer_total) / transfer_rate;
|
int64_t ms_remaining = (total_size - transfer_total) / (transfer_rate/1000.f);
|
||||||
if (seconds_remaining > 0) {
|
if (ms_remaining > 0) {
|
||||||
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s %lds ", fraction * 100 + 0.01f, transfer_rate/byte_divider, byte_suffix, seconds_remaining);
|
const char* duration_suffix = "???";
|
||||||
|
int64_t duration_divider = durationToHumanReadable(ms_remaining, duration_suffix);
|
||||||
|
std::snprintf(
|
||||||
|
overlay_buf, sizeof(overlay_buf),
|
||||||
|
"%.1f%% @ %.1f%s/s %.1f%s",
|
||||||
|
fraction * 100 + 0.01f,
|
||||||
|
|
||||||
|
transfer_rate/byte_divider,
|
||||||
|
byte_suffix,
|
||||||
|
|
||||||
|
double(ms_remaining)/duration_divider,
|
||||||
|
duration_suffix
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s", fraction * 100 + 0.01f, transfer_rate/byte_divider, byte_suffix);
|
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s", fraction * 100 + 0.01f, transfer_rate/byte_divider, byte_suffix);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ struct ToxAVCallVideoSink : public FrameStream2SinkI<SDLVideoFrame> {
|
|||||||
ToxAVI& _toxav;
|
ToxAVI& _toxav;
|
||||||
|
|
||||||
// bitrate for enabled state
|
// bitrate for enabled state
|
||||||
uint32_t _video_bitrate {2000};
|
uint32_t _video_bitrate {1400};
|
||||||
|
|
||||||
uint32_t _fid;
|
uint32_t _fid;
|
||||||
std::shared_ptr<stream_type> _writer;
|
std::shared_ptr<stream_type> _writer;
|
||||||
|
Loading…
Reference in New Issue
Block a user