mirror of
https://github.com/TakeV-Lambda/dino.git
synced 2024-11-25 08:24:19 +00:00
ICE: Use non-blocking send
This commit is contained in:
parent
52698a23d3
commit
09cd060889
1 changed files with 14 additions and 8 deletions
|
@ -39,17 +39,23 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
|
||||||
|
|
||||||
public override void send_datagram(Bytes datagram) {
|
public override void send_datagram(Bytes datagram) {
|
||||||
if (this.agent != null && is_component_ready(agent, stream_id, component_id)) {
|
if (this.agent != null && is_component_ready(agent, stream_id, component_id)) {
|
||||||
uint8[] encrypted_data = null;
|
try {
|
||||||
if (dtls_srtp_handler != null) {
|
if (dtls_srtp_handler != null) {
|
||||||
try {
|
uint8[] encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data());
|
||||||
encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data());
|
|
||||||
if (encrypted_data == null) return;
|
if (encrypted_data == null) return;
|
||||||
} catch (Crypto.Error e) {
|
// TODO: Nonblocking might require certain libnice versions?
|
||||||
warning("%s while send_datagram stream %u component %u", e.message, stream_id, component_id);
|
GLib.OutputVector[] vectors = {{ encrypted_data, encrypted_data.length }};
|
||||||
|
Nice.OutputMessage[] messages = {{ vectors }};
|
||||||
|
agent.send_messages_nonblocking(stream_id, component_id, messages);
|
||||||
|
} else {
|
||||||
|
GLib.OutputVector[] vectors = {{ datagram.get_data(), datagram.get_size() }};
|
||||||
|
Nice.OutputMessage[] messages = {{ vectors }};
|
||||||
|
agent.send_messages_nonblocking(stream_id, component_id, messages);
|
||||||
}
|
}
|
||||||
|
bytes_sent += datagram.length;
|
||||||
|
} catch (GLib.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());
|
|
||||||
bytes_sent += datagram.length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue