summaryrefslogtreecommitdiff
path: root/pjnath/src/pjnath/ice_strans.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-06-25 21:16:46 +0000
committerBenny Prijono <bennylp@teluu.com>2008-06-25 21:16:46 +0000
commit016a4eae3331e0fe7db428ab7381b0fbc93a7267 (patch)
treebfb7bda2734b23901507e403d8661e43cd266572 /pjnath/src/pjnath/ice_strans.c
parentbeffb154962293bb6a355a8f734e7f2ab1379718 (diff)
Optimize the number of characters written to SDP by ICE
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2054 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/src/pjnath/ice_strans.c')
-rw-r--r--pjnath/src/pjnath/ice_strans.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 44442951..ee72aee9 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -45,10 +45,24 @@ enum tp_type
TP_TURN
};
-/* Candidate preference default values */
-#define SRFLX_PREF 65535
-#define HOST_PREF 65530
-#define RELAY_PREF 65525
+/* Candidate's local preference values. This is mostly used to
+ * specify preference among candidates with the same type. Since
+ * we don't have the facility to specify that, we'll just set it
+ * all to zero.
+ */
+#define SRFLX_PREF 0
+#define HOST_PREF 0
+#define RELAY_PREF 0
+
+/* The candidate type preference when STUN candidate is used */
+static pj_uint8_t srflx_pref_table[4] =
+{
+ /* Keep it to 2 bits */
+ 1, /**< PJ_ICE_HOST_PREF */
+ 2, /**< PJ_ICE_SRFLX_PREF */
+ 3, /**< PJ_ICE_PRFLX_PREF */
+ 0 /**< PJ_ICE_RELAYED_PREF */
+};
/* ICE callbacks */
@@ -639,7 +653,6 @@ PJ_DEF(pj_status_t) pj_ice_strans_init_ice(pj_ice_strans *ice_st,
/* Associate user data */
ice_st->ice->user_data = (void*)ice_st;
-#if 0
/* If default candidate for components are SRFLX one, upload a custom
* type priority to ICE session so that SRFLX candidates will get
* checked first.
@@ -648,9 +661,8 @@ PJ_DEF(pj_status_t) pj_ice_strans_init_ice(pj_ice_strans *ice_st,
ice_st->comp[0]->cand_list[ice_st->comp[0]->default_cand].type
== PJ_ICE_CAND_TYPE_SRFLX)
{
- pj_ice_sess_set_prefs(ice_st->ice, srflx_prio);
+ pj_ice_sess_set_prefs(ice_st->ice, srflx_pref_table);
}
-#endif
/* Add components/candidates */
for (i=0; i<ice_st->comp_cnt; ++i) {