Ticket #856: Put back the ICE candidate priority values according to the default values in the draft-mmusic-ice
git-svn-id: https://svn.pjsip.org/repos/pjproject/branches/projects/sipit24@2714 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
b7d38a0d68
commit
42f11696a7
|
@ -259,12 +259,23 @@
|
|||
*/
|
||||
#define PJ_ICE_MAX_COMP (2<<PJ_ICE_COMP_BITS)
|
||||
|
||||
/**
|
||||
* Use the priority value according to the ice-draft.
|
||||
*/
|
||||
#ifndef PJNATH_ICE_PRIO_STD
|
||||
# define PJNATH_ICE_PRIO_STD 1
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* The number of bits to represent candidate type preference.
|
||||
*/
|
||||
#ifndef PJ_ICE_CAND_TYPE_PREF_BITS
|
||||
# if PJNATH_ICE_PRIO_STD
|
||||
# define PJ_ICE_CAND_TYPE_PREF_BITS 8
|
||||
# else
|
||||
# define PJ_ICE_CAND_TYPE_PREF_BITS 2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <pj/rand.h>
|
||||
#include <pj/string.h>
|
||||
|
||||
|
||||
/* String names for candidate types */
|
||||
static const char *cand_type_names[] =
|
||||
{
|
||||
|
@ -242,7 +241,7 @@ PJ_DEF(void) pj_ice_calc_foundation(pj_pool_t *pool,
|
|||
pj_ice_cand_type type,
|
||||
const pj_sockaddr *base_addr)
|
||||
{
|
||||
#if 0
|
||||
#if PJNATH_ICE_PRIO_STD
|
||||
char buf[64];
|
||||
pj_uint32_t val;
|
||||
|
||||
|
@ -658,7 +657,7 @@ static pj_uint32_t CALC_CAND_PRIO(pj_ice_sess *ice,
|
|||
pj_uint32_t local_pref,
|
||||
pj_uint32_t comp_id)
|
||||
{
|
||||
#if 0
|
||||
#if PJNATH_ICE_PRIO_STD
|
||||
return ((ice->prefs[type] & 0xFF) << 24) +
|
||||
((local_pref & 0xFFFF) << 8) +
|
||||
(((256 - comp_id) & 0xFF) << 0);
|
||||
|
@ -1637,8 +1636,13 @@ static pj_status_t perform_check(pj_ice_sess *ice,
|
|||
msg_data->data.req.ckid = check_id;
|
||||
|
||||
/* Add PRIORITY */
|
||||
#if PJNATH_ICE_PRIO_STD
|
||||
prio = CALC_CAND_PRIO(ice, PJ_ICE_CAND_TYPE_PRFLX, 65535,
|
||||
lcand->comp_id);
|
||||
#else
|
||||
prio = CALC_CAND_PRIO(ice, PJ_ICE_CAND_TYPE_PRFLX, 0,
|
||||
lcand->comp_id);
|
||||
#endif
|
||||
pj_stun_msg_add_uint_attr(check->tdata->pool, check->tdata->msg,
|
||||
PJ_STUN_ATTR_PRIORITY, prio);
|
||||
|
||||
|
|
|
@ -50,20 +50,34 @@ enum tp_type
|
|||
/* 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.
|
||||
* all to the same value.
|
||||
*/
|
||||
#define SRFLX_PREF 0
|
||||
#define HOST_PREF 0
|
||||
#define RELAY_PREF 0
|
||||
#if PJNATH_ICE_PRIO_STD
|
||||
# define SRFLX_PREF 65535
|
||||
# define HOST_PREF 65535
|
||||
# define RELAY_PREF 65535
|
||||
#else
|
||||
# define SRFLX_PREF 0
|
||||
# define HOST_PREF 0
|
||||
# define RELAY_PREF 0
|
||||
#endif
|
||||
|
||||
|
||||
/* The candidate type preference when STUN candidate is used */
|
||||
static pj_uint8_t srflx_pref_table[4] =
|
||||
{
|
||||
#if PJNATH_ICE_PRIO_STD
|
||||
100, /**< PJ_ICE_HOST_PREF */
|
||||
126, /**< PJ_ICE_SRFLX_PREF */
|
||||
110, /**< PJ_ICE_PRFLX_PREF */
|
||||
0 /**< PJ_ICE_RELAYED_PREF */
|
||||
#else
|
||||
/* 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 */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue