From e205743f0cb71e32eecf183d067a4f34a7a89d48 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 11 Nov 2021 21:54:55 +0100 Subject: Display target bitrates in connection details UI --- .../call_connection_details_window.vala | 36 +++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'main') diff --git a/main/src/ui/call_window/call_connection_details_window.vala b/main/src/ui/call_window/call_connection_details_window.vala index b292b971..95e00296 100644 --- a/main/src/ui/call_window/call_connection_details_window.vala +++ b/main/src/ui/call_window/call_connection_details_window.vala @@ -8,15 +8,19 @@ namespace Dino.Ui { public Label audio_rtp_ready = new Label("?") { xalign=0, visible=true }; public Label audio_rtcp_ready = new Label("?") { xalign=0, visible=true }; - public Label audio_sent_bps = new Label("?") { xalign=0, visible=true }; - public Label audio_recv_bps = new Label("?") { xalign=0, visible=true }; + public Label audio_sent_bps = new Label("?") { use_markup=true, xalign=0, visible=true }; + public Label audio_recv_bps = new Label("?") { use_markup=true, xalign=0, visible=true }; public Label audio_codec = new Label("?") { xalign=0, visible=true }; + public Label audio_target_receive_bitrate = new Label("n/a") { xalign=0, visible=true }; + public Label audio_target_send_bitrate = new Label("n/a") { xalign=0, visible=true }; public Label video_rtp_ready = new Label("") { xalign=0, visible=true }; public Label video_rtcp_ready = new Label("") { xalign=0, visible=true }; - public Label video_sent_bps = new Label("") { xalign=0, visible=true }; - public Label video_recv_bps = new Label("") { xalign=0, visible=true }; + public Label video_sent_bps = new Label("") { use_markup=true, xalign=0, visible=true }; + public Label video_recv_bps = new Label("") { use_markup=true, xalign=0, visible=true }; public Label video_codec = new Label("") { xalign=0, visible=true }; + public Label video_target_receive_bitrate = new Label("n/a") { xalign=0, visible=true }; + public Label video_target_send_bitrate = new Label("n/a") { xalign=0, visible=true }; private int row_at = 0; private bool video_added = false; @@ -34,6 +38,10 @@ namespace Dino.Ui { grid.attach(audio_recv_bps, 1, row_at++, 1, 1); put_row("Codec"); grid.attach(audio_codec, 1, row_at++, 1, 1); + put_row("Target receive bitrate"); + grid.attach(audio_target_receive_bitrate, 1, row_at++, 1, 1); + put_row("Target send bitrate"); + grid.attach(audio_target_send_bitrate, 1, row_at++, 1, 1); this.child = grid; } @@ -46,18 +54,26 @@ namespace Dino.Ui { audio_rtp_ready.label = peer_info.audio_rtp_ready.to_string(); audio_rtcp_ready.label = peer_info.audio_rtcp_ready.to_string(); audio_codec.label = peer_info.audio_codec + " " + peer_info.audio_clockrate.to_string(); + audio_target_receive_bitrate.label = peer_info.audio_target_receive_bitrate.to_string(); + audio_target_send_bitrate.label = peer_info.audio_target_send_bitrate.to_string(); video_rtp_ready.label = peer_info.video_rtp_ready.to_string(); video_rtcp_ready.label = peer_info.video_rtcp_ready.to_string(); video_codec.label = peer_info.video_codec; + video_target_receive_bitrate.label = peer_info.video_target_receive_bitrate.to_string(); + video_target_send_bitrate.label = peer_info.video_target_send_bitrate.to_string(); if (peer_info.video_content_exists) add_video_widgets(); if (prev_peer_info != null) { - audio_sent_bps.label = (peer_info.audio_bytes_sent - prev_peer_info.audio_bytes_sent).to_string(); - audio_recv_bps.label = (peer_info.audio_bytes_received - prev_peer_info.audio_bytes_received).to_string(); - video_sent_bps.label = (peer_info.video_bytes_sent - prev_peer_info.video_bytes_sent).to_string(); - video_recv_bps.label = (peer_info.video_bytes_received - prev_peer_info.video_bytes_received).to_string(); + ulong audio_sent_kbps = (peer_info.audio_bytes_sent - prev_peer_info.audio_bytes_sent) * 8 / 1000; + audio_sent_bps.label = "%lu kbps".printf(audio_sent_kbps); + ulong audio_recv_kbps = (peer_info.audio_bytes_received - prev_peer_info.audio_bytes_received) * 8 / 1000; + audio_recv_bps.label = "%lu kbps".printf(audio_recv_kbps); + ulong video_sent_kbps = (peer_info.video_bytes_sent - prev_peer_info.video_bytes_sent) * 8 / 1000; + video_sent_bps.label = "%lu kbps".printf(video_sent_kbps); + ulong video_recv_kbps = (peer_info.video_bytes_received - prev_peer_info.video_bytes_received) * 8 / 1000; + video_recv_bps.label = "%lu kbps".printf(video_recv_kbps); } prev_peer_info = peer_info; } @@ -76,6 +92,10 @@ namespace Dino.Ui { grid.attach(video_recv_bps, 1, row_at++, 1, 1); put_row("Codec"); grid.attach(video_codec, 1, row_at++, 1, 1); + put_row("Target receive bitrate"); + grid.attach(video_target_receive_bitrate, 1, row_at++, 1, 1); + put_row("Target send bitrate"); + grid.attach(video_target_send_bitrate, 1, row_at++, 1, 1); video_added = true; } -- cgit v1.2.3-54-g00ecf