From f0a3a75d99f9f89304dc53f20aea0cf7dc8a5661 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 10 Dec 2014 14:19:17 +0100 Subject: [PATCH] fix ice issue when ufrag/pwd are present in sdp media description only --- coreapi/misc.c | 28 ++++++++++++++++++++++++---- mediastreamer2 | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index a869d5301..50ebe68ee 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -845,8 +845,25 @@ static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed){ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) { bool_t ice_restarted = FALSE; - - if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { + bool_t ice_params_found=FALSE; + if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) { + ice_params_found=TRUE; + } else { + int i; + for (i = 0; i < md->nb_streams; i++) { + const SalStreamDescription *stream = &md->streams[i]; + IceCheckList *cl = ice_session_check_list(call->ice_session, i); + if (cl) { + if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { + ice_params_found=TRUE; + } else { + ice_params_found=FALSE; + break; + } + } + } + } + if (ice_params_found) { int i, j; /* Check for ICE restart and set remote credentials. */ @@ -878,11 +895,14 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, IceCheckList *cl = ice_session_check_list(call->ice_session, i); if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) { if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) { - if (ice_restarted == FALSE) { + if (ice_restarted == FALSE + && ice_check_list_remote_ufrag(cl) + && ice_check_list_remote_pwd(cl)) { + /* restart onlu if remote ufrag/paswd was already set*/ ice_session_restart(call->ice_session); ice_restarted = TRUE; } - ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); + ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); break; } } diff --git a/mediastreamer2 b/mediastreamer2 index b4c77370f..5837b2c2a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b4c77370f549f2bd325df484ce123c9f75a44aac +Subproject commit 5837b2c2a0cee22b20f7fc73efdfed41455bba74