1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
using Gtk;
namespace Dino.Ui {
public class CallConnectionDetailsWindow : Gtk.Window {
public Grid grid = new Grid() { column_spacing=5, margin=10, halign=Align.CENTER, valign=Align.CENTER, visible=true };
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_codec = new Label("?") { 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_codec = new Label("") { xalign=0, visible=true };
private int row_at = 0;
private bool video_added = false;
private PeerInfo? prev_peer_info = null;
public CallConnectionDetailsWindow() {
grid.attach(new Label("<b>Audio</b>") { use_markup=true, xalign=0, visible=true }, 0, row_at++, 1, 1);
put_row("RTP");
grid.attach(audio_rtp_ready, 1, row_at++, 1, 1);
put_row("RTCP");
grid.attach(audio_rtcp_ready, 1, row_at++, 1, 1);
put_row("Sent bp/s");
grid.attach(audio_sent_bps, 1, row_at++, 1, 1);
put_row("Received bp/s");
grid.attach(audio_recv_bps, 1, row_at++, 1, 1);
put_row("Codec");
grid.attach(audio_codec, 1, row_at++, 1, 1);
this.child = grid;
}
private void put_row(string label) {
grid.attach(new Label(label) { xalign=0, visible=true }, 0, row_at, 1, 1);
}
public void update_content(PeerInfo peer_info) {
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();
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;
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();
}
prev_peer_info = peer_info;
}
private void add_video_widgets() {
if (video_added) return;
grid.attach(new Label("<b>Video</b>") { use_markup=true, xalign=0, visible=true }, 0, row_at++, 1, 1);
put_row("RTP");
grid.attach(video_rtp_ready, 1, row_at++, 1, 1);
put_row("RTCP");
grid.attach(video_rtcp_ready, 1, row_at++, 1, 1);
put_row("Sent bp/s");
grid.attach(video_sent_bps, 1, row_at++, 1, 1);
put_row("Received bp/s");
grid.attach(video_recv_bps, 1, row_at++, 1, 1);
put_row("Codec");
grid.attach(video_codec, 1, row_at++, 1, 1);
video_added = true;
}
}
}
|