Commit d4887407 authored by Ghislain MARY's avatar Ghislain MARY

Add function to check if an ICE check list can be set to the Completed state...

Add function to check if an ICE check list can be set to the Completed state after adding the losing pairs.
parent ec3580ad
......@@ -550,6 +550,13 @@ MS2_PUBLIC bool_t ice_check_list_selected_valid_local_candidate(const IceCheckLi
*/
MS2_PUBLIC bool_t ice_check_list_selected_valid_remote_candidate(const IceCheckList *cl, const char **rtp_addr, int *rtp_port, const char **rtcp_addr, int *rtcp_port);
/**
* Check if an ICE check list can be set in the Completed state after handling losing pairs.
*
* @param cl A pointer to a check list
*/
MS2_PUBLIC void ice_check_list_check_completed(IceCheckList *cl);
/**
* Get the candidate type as a string.
*
......
......@@ -125,6 +125,7 @@ static int ice_compare_candidates(const IceCandidate *c1, const IceCandidate *c2
static int ice_find_host_candidate(const IceCandidate *candidate, const uint16_t *componentID);
static int ice_find_nominated_valid_pair_from_componentID(const IceValidCandidatePair* valid_pair, const uint16_t* componentID);
static int ice_find_selected_valid_pair_from_componentID(const IceValidCandidatePair* valid_pair, const uint16_t* componentID);
static void ice_find_selected_valid_pair_for_componentID(const uint16_t *componentID, CheckList_Bool *cb);
static int ice_find_running_check_list(const IceCheckList *cl);
static int ice_find_pair_in_valid_list(IceValidCandidatePair *valid_pair, IceCandidatePair *pair);
static void ice_pair_set_state(IceCandidatePair *pair, IceCandidatePairState state);
......@@ -567,6 +568,20 @@ bool_t ice_check_list_selected_valid_remote_candidate(const IceCheckList *cl, co
return TRUE;
}
void ice_check_list_check_completed(IceCheckList *cl)
{
CheckList_Bool cb;
if (cl->state != ICL_Completed) {
cb.cl = cl;
cb.result = TRUE;
ms_list_for_each2(cl->local_componentIDs, (void (*)(void*,void*))ice_find_selected_valid_pair_for_componentID, &cb);
if (cb.result == TRUE) {
ice_check_list_set_state(cl, ICL_Completed);
}
}
}
static void ice_check_list_queue_triggered_check(IceCheckList *cl, IceCandidatePair *pair)
{
MSList *elem = ms_list_find(cl->triggered_checks_queue, pair);
......@@ -2407,14 +2422,22 @@ static int ice_find_nominated_valid_pair_from_componentID(const IceValidCandidat
return !((valid_pair->valid->is_nominated == TRUE) && (valid_pair->valid->local->componentID == *componentID));
}
static void ice_find_nominated_valid_pair_for_componentID(const uint16_t *componentID, CheckList_Bool *cb)
{
MSList *elem = ms_list_find_custom(cb->cl->valid_list, (MSCompareFunc)ice_find_nominated_valid_pair_from_componentID, componentID);
if (elem == NULL) {
/* This component ID is not present in the valid list. */
cb->result = FALSE;
}
}
static int ice_find_selected_valid_pair_from_componentID(const IceValidCandidatePair *valid_pair, const uint16_t *componentID)
{
return !((valid_pair->selected == TRUE) && (valid_pair->valid->local->componentID == *componentID));
}
static void ice_find_nominated_valid_pair_for_componentID(const uint16_t *componentID, CheckList_Bool *cb)
static void ice_find_selected_valid_pair_for_componentID(const uint16_t *componentID, CheckList_Bool *cb)
{
MSList *elem = ms_list_find_custom(cb->cl->valid_list, (MSCompareFunc)ice_find_nominated_valid_pair_from_componentID, componentID);
MSList *elem = ms_list_find_custom(cb->cl->valid_list, (MSCompareFunc)ice_find_selected_valid_pair_from_componentID, componentID);
if (elem == NULL) {
/* This component ID is not present in the valid list. */
cb->result = FALSE;
......
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