mirror of
https://github.com/TakeV-Lambda/dino.git
synced 2024-11-22 06:54:29 +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,18 +39,24 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
|
|||
|
||||
public override void send_datagram(Bytes datagram) {
|
||||
if (this.agent != null && is_component_ready(agent, stream_id, component_id)) {
|
||||
uint8[] encrypted_data = null;
|
||||
if (dtls_srtp_handler != null) {
|
||||
try {
|
||||
encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data());
|
||||
if (dtls_srtp_handler != null) {
|
||||
uint8[] encrypted_data = dtls_srtp_handler.process_outgoing_data(component_id, datagram.get_data());
|
||||
if (encrypted_data == null) return;
|
||||
} catch (Crypto.Error e) {
|
||||
// TODO: Nonblocking might require certain libnice versions?
|
||||
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