Commit 0ebf88d0 authored by Ghislain MARY's avatar Ghislain MARY

Add accessor to get the default local candidate for an ICE check list.

parent f63d4ac5
......@@ -357,13 +357,21 @@ MS2_PUBLIC const char * ice_check_list_remote_ufrag(IceCheckList *cl);
*/
MS2_PUBLIC const char * ice_check_list_remote_pwd(IceCheckList *cl);
/**
* Get the default local candidate for an ICE check list.
*
* @param cl A pointer to a check list
* @return A pointer to the default local candidate for the check list if found, NULL otherwise
*/
MS2_PUBLIC const IceCandidate * ice_check_list_default_local_candidate(IceCheckList *cl);
/**
* Get the candidate type as a string.
*
* @param candidate A pointer to a candidate
* @return A pointer to the candidate type as a string
*/
MS2_PUBLIC const char *ice_candidate_type(IceCandidate *candidate);
MS2_PUBLIC const char * ice_candidate_type(const IceCandidate *candidate);
/**
* Add a local candidate to an ICE check list.
......
......@@ -306,7 +306,7 @@ void ice_check_list_destroy(IceCheckList *cl)
* CANDIDATE ACCESSORS *
*****************************************************************************/
const char *ice_candidate_type(IceCandidate *candidate)
const char *ice_candidate_type(const IceCandidate *candidate)
{
return candidate_type_values[candidate->type];
}
......@@ -366,6 +366,21 @@ const char * ice_check_list_remote_pwd(IceCheckList *cl)
else return cl->session->remote_pwd;
}
static int ice_find_default_local_candidate(IceCandidate *candidate, void *dummy)
{
return !((candidate->componentID == 1) && (candidate->is_default == TRUE));
}
const IceCandidate * ice_check_list_default_local_candidate(IceCheckList *cl)
{
IceCandidate *candidate = NULL;
MSList *elem = ms_list_find_custom(cl->local_candidates, (MSCompareFunc)ice_find_default_local_candidate, NULL);
if (elem != NULL) {
candidate = (IceCandidate *)elem->data;
}
return candidate;
}
void ice_check_list_set_remote_credentials(IceCheckList *cl, const char *ufrag, const char *pwd)
{
ice_set_credentials(&cl->remote_ufrag, &cl->remote_pwd, ufrag, pwd);
......
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