Bug 962371 - Part 1: Make priority for TCP relayed candidates lower than UDP relayed candidates. r=abr
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 22 Jan 2014 14:13:43 -0800
changeset 181333 c4cd87e4421324b8ba206d276baf0048c2baee52
parent 181332 d6646242ba7778102e3240a02194464317a76cff
child 181334 5b888357a3b28a307640500bb44561b86641187a
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs962371
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 962371 - Part 1: Make priority for TCP relayed candidates lower than UDP relayed candidates. r=abr
media/mtransport/nricectx.cpp
media/mtransport/third_party/nICEr/src/ice/ice_candidate.c
media/mtransport/third_party/nICEr/src/ice/ice_reg.h
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -369,17 +369,18 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const 
     nr_crypto_vtbl = &nr_ice_crypto_nss_vtbl;
     initialized = true;
 
     // Set the priorites for candidate type preferences.
     // These numbers come from RFC 5245 S. 4.1.2.2
     NR_reg_set_uchar((char *)"ice.pref.type.srv_rflx", 100);
     NR_reg_set_uchar((char *)"ice.pref.type.peer_rflx", 110);
     NR_reg_set_uchar((char *)"ice.pref.type.host", 126);
-    NR_reg_set_uchar((char *)"ice.pref.type.relayed", 0);
+    NR_reg_set_uchar((char *)"ice.pref.type.relayed", 5);
+    NR_reg_set_uchar((char *)"ice.pref.type.relayed_tcp", 0);
 
     if (set_interface_priorities) {
       NR_reg_set_uchar((char *)"ice.pref.interface.rl0", 255);
       NR_reg_set_uchar((char *)"ice.pref.interface.wi0", 254);
       NR_reg_set_uchar((char *)"ice.pref.interface.lo0", 253);
       NR_reg_set_uchar((char *)"ice.pref.interface.en1", 252);
       NR_reg_set_uchar((char *)"ice.pref.interface.en0", 251);
       NR_reg_set_uchar((char *)"ice.pref.interface.eth0", 252);
--- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c
@@ -351,18 +351,30 @@ int nr_ice_candidate_compute_priority(nr
 
     switch(cand->type){
       case HOST:
         if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_HOST,&type_preference))
           ABORT(r);
         stun_priority=0;
         break;
       case RELAYED:
-        if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_RELAYED,&type_preference))
-          ABORT(r);
+        if(cand->base.protocol == IPPROTO_UDP) {
+          if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_RELAYED,&type_preference))
+            ABORT(r);
+        }
+        else if(cand->base.protocol == IPPROTO_TCP) {
+          if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_RELAYED_TCP,&type_preference))
+            ABORT(r);
+
+        }
+        else {
+          r_log(LOG_ICE,LOG_ERR,"Unknown protocol type %u",
+                (unsigned int)cand->base.protocol);
+          ABORT(R_INTERNAL);
+        }
         stun_priority=255-cand->stun_server->index;
         break;
       case SERVER_REFLEXIVE:
         if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_SRV_RFLX,&type_preference))
           ABORT(r);
         stun_priority=255-cand->stun_server->index;
         break;
       case PEER_REFLEXIVE:
--- a/media/mtransport/third_party/nICEr/src/ice/ice_reg.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_reg.h
@@ -38,16 +38,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 using namespace std;
 extern "C" {
 #endif /* __cplusplus */
 
 #define NR_ICE_REG_PREF_TYPE_HOST       "ice.pref.type.host"
 #define NR_ICE_REG_PREF_TYPE_RELAYED    "ice.pref.type.relayed"
 #define NR_ICE_REG_PREF_TYPE_SRV_RFLX   "ice.pref.type.srv_rflx"
 #define NR_ICE_REG_PREF_TYPE_PEER_RFLX  "ice.pref.type.peer_rflx"
+#define NR_ICE_REG_PREF_TYPE_RELAYED_TCP    "ice.pref.type.relayed_tcp"
 
 #define NR_ICE_REG_PREF_INTERFACE_PRFX      "ice.pref.interface"
 #define NR_ICE_REG_SUPPRESS_INTERFACE_PRFX  "ice.suppress.interface"
 
 #define NR_ICE_REG_STUN_SRV_PRFX        "ice.stun.server"
 #define NR_ICE_REG_STUN_SRV_ADDR        "addr"
 #define NR_ICE_REG_STUN_SRV_PORT        "port"