mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-24 13:48:51 +08:00
[fix] unify network statistics resolution formatting
This commit is contained in:
@@ -466,6 +466,10 @@ std::string ConnectionStatusText(ConnectionStatus status, int language) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FormatResolution(int width, int height) {
|
||||||
|
return std::to_string(width) + " × " + std::to_string(height);
|
||||||
|
}
|
||||||
|
|
||||||
std::string FormatBitrate(uint32_t bits_per_second) {
|
std::string FormatBitrate(uint32_t bits_per_second) {
|
||||||
char text[48];
|
char text[48];
|
||||||
if (bits_per_second < 1000) {
|
if (bits_per_second < 1000) {
|
||||||
@@ -3666,8 +3670,8 @@ void GuiApplication::SyncStreamWindow() {
|
|||||||
net.total_inbound_stats, net.total_outbound_stats);
|
net.total_inbound_stats, net.total_outbound_stats);
|
||||||
ui::UpdateModelRows(*ui_->stats_model, std::move(stats_rows));
|
ui::UpdateModelRows(*ui_->stats_model, std::move(stats_rows));
|
||||||
(*ui_->stream)
|
(*ui_->stream)
|
||||||
->set_stats_resolution(UiText(std::to_string(props->video_width_) + " × " +
|
->set_stats_resolution(UiText(FormatResolution(props->video_width_,
|
||||||
std::to_string(props->video_height_)));
|
props->video_height_)));
|
||||||
(*ui_->stream)
|
(*ui_->stream)
|
||||||
->set_stats_connection_mode(
|
->set_stats_connection_mode(
|
||||||
UiText(props->traversal_mode_ == TraversalMode::P2P
|
UiText(props->traversal_mode_ == TraversalMode::P2P
|
||||||
@@ -3755,8 +3759,7 @@ void GuiApplication::SyncStreamVideoFrame() {
|
|||||||
const auto result = ui_->video_presenter->Present(frame);
|
const auto result = ui_->video_presenter->Present(frame);
|
||||||
if (result.width > 0 && result.height > 0) {
|
if (result.width > 0 && result.height > 0) {
|
||||||
(*ui_->stream)
|
(*ui_->stream)
|
||||||
->set_stats_resolution(UiText(std::to_string(result.width) + "x" +
|
->set_stats_resolution(UiText(FormatResolution(result.width, result.height)));
|
||||||
std::to_string(result.height)));
|
|
||||||
}
|
}
|
||||||
if (result.new_frame) {
|
if (result.new_frame) {
|
||||||
++props->frame_count_;
|
++props->frame_count_;
|
||||||
@@ -5742,7 +5745,7 @@ void GuiApplication::SyncGallery() {
|
|||||||
}
|
}
|
||||||
const auto video = props->received_video_stats_.Get(now);
|
const auto video = props->received_video_stats_.Get(now);
|
||||||
device.resolution = video.width > 0 && video.height > 0
|
device.resolution = video.width > 0 && video.height > 0
|
||||||
? UiText(std::to_string(video.width) + " × " + std::to_string(video.height))
|
? UiText(FormatResolution(video.width, video.height))
|
||||||
: UiText("—");
|
: UiText("—");
|
||||||
device.fps = video.fps ? UiText(std::to_string(*video.fps) + " FPS") : UiText("—");
|
device.fps = video.fps ? UiText(std::to_string(*video.fps) + " FPS") : UiText("—");
|
||||||
const auto codecs = props->net_traffic_stats_.LoadVideoCodecs();
|
const auto codecs = props->net_traffic_stats_.LoadVideoCodecs();
|
||||||
|
|||||||
Reference in New Issue
Block a user