ICE: Report transferred bytes for UI
This commit is contained in:
parent
f398135bc8
commit
6fa5702e9c
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue