aboutsummaryrefslogtreecommitdiff
path: root/plugins/ice
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2021-11-09 22:06:49 +0100
committerfiaxh <git@lightrise.org>2021-11-10 11:05:34 +0100
commit6fa5702e9c9f8201f923210a2a54790ba9bc3a69 (patch)
tree41272d2485ab33f605f01fc25c26472e5f6f79ac /plugins/ice
parentf398135bc8a21343058f7861abfc083337bc401d (diff)
downloaddino-6fa5702e9c9f8201f923210a2a54790ba9bc3a69.tar.gz
dino-6fa5702e9c9f8201f923210a2a54790ba9bc3a69.zip
ICE: Report transferred bytes for UI
Diffstat (limited to 'plugins/ice')
-rw-r--r--plugins/ice/src/transport_parameters.vala24
1 files changed, 8 insertions, 16 deletions
diff --git a/plugins/ice/src/transport_parameters.vala b/plugins/ice/src/transport_parameters.vala
index 62c04906..cb9cea07 100644
--- a/plugins/ice/src/transport_parameters.vala
+++ b/plugins/ice/src/transport_parameters.vala
@@ -16,10 +16,6 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
private DtlsSrtp.Handler? dtls_srtp_handler;
private uint stream_id;
private string? error;
- private ulong sent;
- private ulong sent_reported;
- private ulong recv;
- private ulong recv_reported;
private ulong datagram_received_id;
public DatagramConnection(Nice.Agent agent, DtlsSrtp.Handler? dtls_srtp_handler, uint stream_id, uint8 component_id) {
@@ -28,11 +24,7 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
this.stream_id = stream_id;
this.component_id = component_id;
this.datagram_received_id = this.datagram_received.connect((datagram) => {
- recv += datagram.length;
- if (recv > recv_reported + 100000) {
- debug("Received %lu bytes via stream %u component %u", recv, stream_id, component_id);
- recv_reported = recv;
- }
+ bytes_received += datagram.length;
});
}
@@ -47,15 +39,15 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
if (this.agent != null && is_component_ready(agent, stream_id, component_id)) {
uint8[] encrypted_data = null;
if (dtls_srtp_handler != null) {
- encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data());
- if (encrypted_data == null) return;
+ try {
+ encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data());
+ if (encrypted_data == null) return;
+ } catch (Crypto.Error e) {
+ warning("%s while send_datagram stream %u component %u", e.message, stream_id, component_id);
+ }
}
agent.send(stream_id, component_id, encrypted_data ?? datagram.get_data());
- sent += datagram.length;
- if (sent > sent_reported + 100000) {
- debug("Sent %lu bytes via stream %u component %u", sent, stream_id, component_id);
- sent_reported = sent;
- }
+ bytes_sent += datagram.length;
}
}
}