Commit 3045c9b5 authored by Youness Alaoui's avatar Youness Alaoui Committed by Olivier Crête

Change priority algorithm for better values

Now we will always give a handicap to UDP candidates, but still give
relays the lower priority. We have the following priorities now :
In reliable mode :
TCP Host : 120
TCP peer-refl : 110
TCP nat-assist : 105
TCP srv-refl : 100
UDP Host : 60
UDP peer-refl : 55
UDP nat-assist : 52
UDP srv-refl : 50
TCP relay : 10
UDP relay : 5

In unreliable mode :
UDP Host : 120
UDP peer-refl : 110
UDP nat-assist : 105
UDP srv-refl : 100
TCP Host : 60
TCP peer-refl : 55
TCP nat-assist : 52
TCP srv-refl : 50
UDP relay : 10
TCP relay : 5
parent 218667da
......@@ -207,10 +207,9 @@ nice_candidate_ice_priority (const NiceCandidate *candidate,
break;
}
if (reliable && candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP) {
type_preference = NICE_CANDIDATE_TYPE_PREF_UDP_TUNNELED;
} else if (!reliable && candidate->transport != NICE_CANDIDATE_TRANSPORT_UDP) {
type_preference = type_preference / 2 - 1;
if ((reliable && candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP) ||
(!reliable && candidate->transport != NICE_CANDIDATE_TRANSPORT_UDP)) {
type_preference = type_preference / 2;
}
local_preference = nice_candidate_ice_local_priority (candidate);
......
......@@ -62,7 +62,7 @@ G_BEGIN_DECLS
#define NICE_CANDIDATE_TYPE_PREF_NAT_ASSISTED 105
#define NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE 100
#define NICE_CANDIDATE_TYPE_PREF_UDP_TUNNELED 75
#define NICE_CANDIDATE_TYPE_PREF_RELAYED 60
#define NICE_CANDIDATE_TYPE_PREF_RELAYED 10
/* Max foundation size '1*32ice-char' plus terminating NULL, ICE ID-19 */
/**
......
......@@ -52,11 +52,11 @@ main (void)
candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
candidate->component_id = 1;
g_assert (nice_candidate_ice_priority (candidate, FALSE, FALSE) == 0x780001FF);
/* Host UDP-tunneled reliable */
g_assert (nice_candidate_ice_priority (candidate, TRUE, FALSE) == 0x4B0001FF);
/* Host UDP reliable */
g_assert (nice_candidate_ice_priority (candidate, TRUE, FALSE) == 0x3C0001FF);
/* Host tcp-active unreliable */
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
g_assert (nice_candidate_ice_priority (candidate, FALSE, FALSE) == 0x3BC001FF);
g_assert (nice_candidate_ice_priority (candidate, FALSE, FALSE) == 0x3CC001FF);
/* Host tcp-active reliable */
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
/* Host tcp-active reliable */
......
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