Browse Source

TT#14008 attempt to match ICE foundations for learned prflx cands

Instead of always generating a new ICE foundation string for every
learned peer-reflexive candidate, try to use the same foundation string
for candidates that belong together. We use the priority number plus the
component ID for this to see if we've learned a candidate with a fitting
priority number before. If we have then re-use the same ICE foundation
string. This allows ICE to complete with only learned prflx candidates
and without (or before) re-invite to communicate the correct ICE
foundations.

Change-Id: I74bde6ef22a164df57d0b77cbaef34e4a499da72
mr10.4
Richard Fuchs 4 years ago
parent
commit
89f5a988c9
1 changed files with 21 additions and 1 deletions
  1. +21
    -1
      daemon/ice.c

+ 21
- 1
daemon/ice.c View File

@ -860,7 +860,27 @@ static struct ice_candidate_pair *__learned_candidate(struct ice_agent *ag, stru
cand->priority = priority;
cand->endpoint = *src;
cand->type = ICT_PRFLX;
__cand_ice_foundation(call, cand);
// check if we've already learned another candidate that belongs to this one. use the priority number
// together with the component to guess a matching other candidate.
unsigned long prio_base = priority + ps->component;
struct ice_candidate *known_cand = NULL;
for (unsigned int comp = 1; comp <= ag->active_components; comp++) {
if (comp == ps->component)
continue;
unsigned long prio = prio_base - comp;
known_cand = g_hash_table_lookup(ag->cand_prio_hash, GUINT_TO_POINTER(prio));
if (known_cand)
break;
}
if (known_cand) {
// got one. use the previously learned generated ICE foundation string also for this one:
cand->foundation = known_cand->foundation;
}
else {
// make new:
__cand_ice_foundation(call, cand);
}
old_cand = __foundation_lookup(ag, &cand->foundation, ps->component);
if (old_cand && old_cand->priority > priority) {


Loading…
Cancel
Save