From 24fcd267692ef9914ee4252d36e83fb261e0c4a0 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 22 Mar 2022 15:19:26 -0400 Subject: [PATCH] TT#14008 keep track of ICE candidates based on their priorities Change-Id: Ibb248d634d498bc68497be7d036be54956b1de61 (cherry picked from commit 24ed84357a96fd3621e455eeb1e4d8b836e88b73) --- daemon/ice.c | 4 ++++ include/ice.h | 1 + 2 files changed, 5 insertions(+) diff --git a/daemon/ice.c b/daemon/ice.c index e2bcbde3f..78dd68296 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -232,6 +232,7 @@ static void __ice_agent_initialize(struct ice_agent *ag) { struct call *call = ag->call; ag->candidate_hash = g_hash_table_new(__cand_hash, __cand_equal); + ag->cand_prio_hash = g_hash_table_new(g_direct_hash, g_direct_equal); ag->pair_hash = g_hash_table_new(__pair_hash, __pair_equal); ag->transaction_hash = g_hash_table_new(__trans_hash, __trans_equal); ag->foundation_hash = g_hash_table_new(__found_hash, __found_equal); @@ -417,6 +418,7 @@ void ice_update(struct ice_agent *ag, struct stream_params *sp) { dup = g_slice_alloc(sizeof(*dup)); __copy_cand(call, dup, cand); g_hash_table_insert(ag->candidate_hash, dup, dup); + g_hash_table_insert(ag->cand_prio_hash, GUINT_TO_POINTER(dup->priority), dup); g_queue_push_tail(&ag->remote_candidates, dup); } @@ -498,6 +500,7 @@ static void __ice_agent_free_components(struct ice_agent *ag) { g_queue_clear(&ag->triggered); g_hash_table_destroy(ag->candidate_hash); + g_hash_table_destroy(ag->cand_prio_hash); g_hash_table_destroy(ag->pair_hash); g_hash_table_destroy(ag->transaction_hash); g_hash_table_destroy(ag->foundation_hash); @@ -871,6 +874,7 @@ static struct ice_candidate_pair *__learned_candidate(struct ice_agent *ag, stru g_queue_push_tail(&ag->remote_candidates, cand); g_hash_table_insert(ag->candidate_hash, cand, cand); + g_hash_table_insert(ag->cand_prio_hash, GUINT_TO_POINTER(cand->priority), cand); g_hash_table_insert(ag->foundation_hash, cand, cand); pair: diff --git a/include/ice.h b/include/ice.h index d2a52a4f1..b9980bbbe 100644 --- a/include/ice.h +++ b/include/ice.h @@ -118,6 +118,7 @@ struct ice_agent { GQueue candidate_pairs; /* for storage */ GQueue triggered; GHashTable *candidate_hash; + GHashTable *cand_prio_hash; GHashTable *pair_hash; GHashTable *transaction_hash; GHashTable *foundation_hash;