]> sjero.net Git - linphone/commitdiff
Check that ICE gathering has already been completed before launching it again.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Mon, 1 Oct 2012 13:48:43 +0000 (15:48 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Mon, 1 Oct 2012 13:50:50 +0000 (15:50 +0200)
coreapi/misc.c

index d5e34ce03a2ed34cf3f3a484ec3173bf0e2c9f21..1c026948e1b5ccedc6e8f684dc7f67a1302426ab 100644 (file)
@@ -624,10 +624,13 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call)
                ms_error("Fail to get local ip");
                return -1;
        }
-       ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL);
-       ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL);
-       call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress;
-       if (call->params.has_video && (video_check_list != NULL)) {
+       if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) {
+               ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port, 1, NULL);
+               ice_add_local_candidate(audio_check_list, "host", local_addr, call->audio_port + 1, 2, NULL);
+               call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress;
+       }
+       if (call->params.has_video && (video_check_list != NULL)
+               && (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) {
                ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port, 1, NULL);
                ice_add_local_candidate(video_check_list, "host", local_addr, call->video_port + 1, 2, NULL);
                call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress;