Commit 4c80e203 authored by Olivier Crête's avatar Olivier Crête

candidate: Test against possible type

There was a confusion and it tested against a value not in the enum.
parent d71a6330
......@@ -191,21 +191,21 @@ nice_candidate_ice_local_preference (const NiceCandidate *candidate)
{
case NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE:
if (candidate->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
candidate->type == NICE_CANDIDATE_TYPE_PREF_NAT_ASSISTED)
candidate->type == NICE_CANDIDATE_TYPE_HOST)
direction_preference = 4;
else
direction_preference = 6;
break;
case NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE:
if (candidate->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
candidate->type == NICE_CANDIDATE_TYPE_PREF_NAT_ASSISTED)
candidate->type == NICE_CANDIDATE_TYPE_HOST)
direction_preference = 2;
else
direction_preference = 4;
break;
case NICE_CANDIDATE_TRANSPORT_TCP_SO:
if (candidate->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
candidate->type == NICE_CANDIDATE_TYPE_PREF_NAT_ASSISTED)
candidate->type == NICE_CANDIDATE_TYPE_HOST)
direction_preference = 6;
else
direction_preference = 2;
......
......@@ -61,11 +61,11 @@ main (void)
g_assert_cmpuint (nice_candidate_ice_priority (candidate, TRUE, FALSE), ==, 0x3C0001FF);
/* Host tcp-active unreliable */
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
g_assert_cmpuint (nice_candidate_ice_priority (candidate, FALSE, FALSE) & 0xFFE000FF, ==, 0x3CC000FF);
g_assert_cmpuint (nice_candidate_ice_priority (candidate, FALSE, FALSE) & 0xFFE000FF, ==, 0x3C8000FF);
/* Host tcp-active reliable */
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
/* Host tcp-active reliable */
g_assert_cmpuint (nice_candidate_ice_priority (candidate, TRUE, FALSE) & 0xFFE000FF, ==, 0x78C000FF);
g_assert_cmpuint (nice_candidate_ice_priority (candidate, TRUE, FALSE) & 0xFFE000FF, ==, 0x788000FF);
/* srv-reflexive tcp-active reliable */
candidate->type = NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE;
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
......
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