ice: enable aggressive nomination to avoid latencies

As specified in RFC 5245, the aggressive negotiation uses the
candidates as soon as possibe. This avoid some possible latencies
due to the negotiation of an unique pair.

For our use case, this avoid a 30 seconds delay during the media
negotiation in some cases.

Change-Id: I155a0c5f5706908d5e86a08fb2d65e0e3b8c61e2
Gitlab: #140
parent 560473e0
......@@ -71,7 +71,9 @@ struct IceTransportOptions {
std::vector<StunServerInfo> stunServers;
std::vector<TurnServerInfo> turnServers;
bool tcpEnable {false}; // If we want to use TCP
bool aggressive {false}; // If we use the aggressive nomination strategy
// See https://tools.ietf.org/html/rfc5245#section-8.1.1.2
// Make negotiation aggressive by default to avoid latencies.
bool aggressive {true};
};
struct SDP {
......
......@@ -482,7 +482,6 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
auto ice_config = getIceOptions();
ice_config.tcpEnable = true;
ice_config.aggressive = true; // This will directly select the first candidate.
auto ice_tcp = createIceTransport(("sip:" + dev_call->getCallId()).c_str(), ICE_COMPONENTS, true, ice_config);
if (not ice_tcp) {
JAMI_WARN("Can't create ICE over TCP, will only use UDP");
......@@ -2543,7 +2542,6 @@ JamiAccount::incomingCall(dht::IceCandidates&& msg, const std::shared_ptr<dht::c
auto ice = createIceTransport(("sip:"+call->getCallId()).c_str(), ICE_COMPONENTS, false, getIceOptions());
auto ice_config = getIceOptions();
ice_config.tcpEnable = true;
ice_config.aggressive = true; // This will directly select the first candidate.
auto ice_tcp = createIceTransport(("sip:" + call->getCallId()).c_str(), ICE_COMPONENTS, true, ice_config);
std::weak_ptr<SIPCall> wcall = call;
......
......@@ -373,7 +373,6 @@ private:
auto &iceTransportFactory = Manager::instance().getIceTransportFactory();
auto ice_config = parent_.account.getIceOptions();
ice_config.tcpEnable = true;
ice_config.aggressive = true; // This will directly select the first candidate.
auto ice = iceTransportFactory.createTransport(parent_.account.getAccountID().c_str(), 1, false, ice_config);
if (ice->waitForInitialization(ICE_INIT_TIMEOUT) <= 0) {
......@@ -728,7 +727,6 @@ DhtPeerConnector::Impl::answerToRequest(PeerConnectionMsg&& request,
auto &iceTransportFactory = Manager::instance().getIceTransportFactory();
auto ice_config = account.getIceOptions();
ice_config.tcpEnable = true;
ice_config.aggressive = true;
ice_config.onRecvReady = [iceReady]() {
auto& ir = *iceReady;
std::lock_guard<std::mutex> lk{ir.mtx};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment