aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-11-15 13:29:13 +0100
committerfiaxh <git@lightrise.org>2021-11-15 13:29:13 +0100
commit2b3d150949fe1b3c4107e497be7dac8e2ba734aa (patch)
tree09eeff090da1337142ea1089abe72396979bccf7 /libdino/src/service
parentec6541518684d7c61c6475498c4ddf25d8f96b55 (diff)
downloaddino-2b3d150949fe1b3c4107e497be7dac8e2ba734aa.tar.gz
dino-2b3d150949fe1b3c4107e497be7dac8e2ba734aa.zip
Improve call details dialog + small multi-party call fixes
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/call_peer_state.vala86
-rw-r--r--libdino/src/service/calls.vala11
2 files changed, 42 insertions, 55 deletions
diff --git a/libdino/src/service/call_peer_state.vala b/libdino/src/service/call_peer_state.vala
index c7bcd201..8c4b0930 100644
--- a/libdino/src/service/call_peer_state.vala
+++ b/libdino/src/service/call_peer_state.vala
@@ -251,53 +251,43 @@ public class Dino.PeerState : Object {
public PeerInfo get_info() {
var ret = new PeerInfo();
-
- if (audio_content_parameter != null) {
- ret.audio_rtcp_ready = audio_content_parameter.rtcp_ready;
- ret.audio_rtp_ready = audio_content_parameter.rtp_ready;
-
- if (audio_content_parameter.agreed_payload_type != null) {
- ret.audio_codec = audio_content_parameter.agreed_payload_type.name;
- ret.audio_clockrate = audio_content_parameter.agreed_payload_type.clockrate;
- }
- if (audio_content_parameter.stream != null && audio_content_parameter.stream.remb_enabled) {
- ret.audio_target_receive_bitrate = audio_content_parameter.stream.target_receive_bitrate;
- ret.audio_target_send_bitrate = audio_content_parameter.stream.target_send_bitrate;
- }
+ if (audio_content != null || audio_content_parameter != null) {
+ ret.audio = get_content_info(audio_content, audio_content_parameter);
}
-
- if (audio_content != null) {
- Xmpp.Xep.Jingle.ComponentConnection? component0 = audio_content.get_transport_connection(1);
- if (component0 != null) {
- ret.audio_bytes_received = component0.bytes_received;
- ret.audio_bytes_sent = component0.bytes_sent;
- }
+ if (video_content != null || video_content_parameter != null) {
+ ret.video = get_content_info(video_content, video_content_parameter);
}
+ return ret;
+ }
- if (video_content_parameter != null) {
- ret.video_content_exists = true;
- ret.video_rtcp_ready = video_content_parameter.rtcp_ready;
- ret.video_rtp_ready = video_content_parameter.rtp_ready;
+ private PeerContentInfo get_content_info(Xep.Jingle.Content? content, Xep.JingleRtp.Parameters? parameter) {
+ PeerContentInfo ret = new PeerContentInfo();
+ if (parameter != null) {
+ ret.rtcp_ready = parameter.rtcp_ready;
+ ret.rtp_ready = parameter.rtp_ready;
- if (video_content_parameter.agreed_payload_type != null) {
- ret.video_codec = video_content_parameter.agreed_payload_type.name;
+ if (parameter.agreed_payload_type != null) {
+ ret.codec = parameter.agreed_payload_type.name;
+ ret.clockrate = parameter.agreed_payload_type.clockrate;
}
- if (video_content_parameter.stream != null && video_content_parameter.stream.remb_enabled) {
- ret.video_target_receive_bitrate = video_content_parameter.stream.target_receive_bitrate;
- ret.video_target_send_bitrate = video_content_parameter.stream.target_send_bitrate;
+ if (parameter.stream != null && parameter.stream.remb_enabled) {
+ ret.target_receive_bytes = parameter.stream.target_receive_bitrate;
+ ret.target_send_bytes = parameter.stream.target_send_bitrate;
}
}
- if (video_content != null) {
- Xmpp.Xep.Jingle.ComponentConnection? component0 = video_content.get_transport_connection(1);
+ if (content != null) {
+ Xmpp.Xep.Jingle.ComponentConnection? component0 = content.get_transport_connection(1);
if (component0 != null) {
- ret.video_bytes_received = component0.bytes_received;
- ret.video_bytes_sent = component0.bytes_sent;
+ ret.bytes_received = component0.bytes_received;
+ ret.bytes_sent = component0.bytes_sent;
}
}
return ret;
}
+
+
private void connect_content_signals(Xep.Jingle.Content content, Xep.JingleRtp.Parameters rtp_content_parameter) {
if (rtp_content_parameter.media == "audio") {
audio_content = content;
@@ -444,22 +434,18 @@ public class Dino.PeerState : Object {
}
}
+public class Dino.PeerContentInfo {
+ public bool rtp_ready { get; set; }
+ public bool rtcp_ready { get; set; }
+ public ulong? bytes_sent { get; set; default=0; }
+ public ulong? bytes_received { get; set; default=0; }
+ public string? codec { get; set; }
+ public uint32 clockrate { get; set; }
+ public uint target_receive_bytes { get; set; default=-1; }
+ public uint target_send_bytes { get; set; default=-1; }
+}
+
public class Dino.PeerInfo {
- public bool audio_rtp_ready { get; set; }
- public bool audio_rtcp_ready { get; set; }
- public ulong? audio_bytes_sent { get; set; default=0; }
- public ulong? audio_bytes_received { get; set; default=0; }
- public string? audio_codec { get; set; }
- public uint32 audio_clockrate { get; set; }
- public uint audio_target_receive_bitrate { get; set; default=0; }
- public uint audio_target_send_bitrate { get; set; default=0; }
-
- public bool video_content_exists { get; set; }
- public bool video_rtp_ready { get; set; }
- public bool video_rtcp_ready { get; set; }
- public ulong? video_bytes_sent { get; set; default=0; }
- public ulong? video_bytes_received { get; set; default=0; }
- public string? video_codec { get; set; }
- public uint video_target_receive_bitrate { get; set; default=0; }
- public uint video_target_send_bitrate { get; set; default=0; }
+ public PeerContentInfo? audio = null;
+ public PeerContentInfo? video = null;
} \ No newline at end of file
diff --git a/libdino/src/service/calls.vala b/libdino/src/service/calls.vala
index 51ed6e78..3d1ed7e8 100644
--- a/libdino/src/service/calls.vala
+++ b/libdino/src/service/calls.vala
@@ -202,16 +202,17 @@ namespace Dino {
// Call requested by another of our devices
call.direction = Call.DIRECTION_OUTGOING;
call.ourpart = from;
+ call.state = Call.State.OTHER_DEVICE;
counterpart = to;
} else {
call.direction = Call.DIRECTION_INCOMING;
call.ourpart = account.full_jid;
+ call.state = Call.State.RINGING;
counterpart = from;
}
call.add_peer(counterpart);
call.account = account;
call.time = call.local_time = call.end_time = new DateTime.now_utc();
- call.state = Call.State.RINGING;
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(counterpart.bare_jid, account, Conversation.Type.CHAT);
@@ -329,7 +330,7 @@ namespace Dino {
current_jmi_request_peer[account] = peer_state;
current_jmi_request_call[account] = call_states[peer_state.call];
});
- mi_module.session_accepted.connect((from, sid) => {
+ mi_module.session_accepted.connect((from, to, sid) => {
if (!current_jmi_request_peer.has_key(account) || current_jmi_request_peer[account].sid != sid) return;
if (from.equals_bare(account.bare_jid)) { // Carboned message from our account
@@ -337,9 +338,9 @@ namespace Dino {
if (from.equals(account.full_jid)) return;
Call call = current_jmi_request_peer[account].call;
- call.state = Call.State.OTHER_DEVICE_ACCEPTED;
+ call.state = Call.State.OTHER_DEVICE;
remove_call_from_datastructures(call);
- } else if (from.equals_bare(current_jmi_request_peer[account].jid)) { // Message from our peer
+ } else if (from.equals_bare(current_jmi_request_peer[account].jid) && to.equals(account.full_jid)) { // Message from our peer
// We proposed the call
// We know the full jid of our peer now
current_jmi_request_call[account].rename_peer(current_jmi_request_peer[account].jid, from);
@@ -383,7 +384,7 @@ namespace Dino {
CallState? call_state = get_call_state_for_groupcall(account, muc_jid);
if (call_state == null) return;
- call_state.call.state = Call.State.OTHER_DEVICE_ACCEPTED;
+ call_state.call.state = Call.State.OTHER_DEVICE;
remove_call_from_datastructures(call_state.call);
});
muji_meta_module.call_retracted.connect((from_jid, muc_jid) => {