diff --git a/daemon/ice.c b/daemon/ice.c index ab874dcdc..5223f7a8f 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); @@ -420,6 +421,7 @@ void ice_update(struct ice_agent *ag, struct stream_params *sp, bool allow_reset 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); } @@ -501,6 +503,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); @@ -874,6 +877,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 d064c8930..90d758a00 100644 --- a/include/ice.h +++ b/include/ice.h @@ -120,6 +120,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;