From 65c46c6cb81c4ae173fb975cb5c11067519491b0 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 2 Aug 2012 12:16:25 +0200 Subject: [PATCH] Defer acceptation of video activation to gather ICE candidates if ICE is enabled. --- coreapi/linphonecall.c | 21 +++++++++++++++++---- gtk/main.c | 6 +----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b604c9de..19e64b09 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -565,14 +565,22 @@ void linphone_call_enable_video(LinphoneCall *call, bool_t enabled) video_stream_start_ice_gathering(call->videostream); linphone_core_gather_ice_candidates(lc, call); } else { - linphone_core_update_call(lc, call, params); + if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { + linphone_core_accept_call_update(lc, call, params); + } else { + linphone_core_update_call(lc, call, params); + } } } else { if (ice_session != NULL) { ice_session_remove_check_list(ice_session, call->videostream->ice_check_list); call->videostream->ice_check_list = NULL; } - linphone_core_update_call(lc, call, params); + if (linphone_call_get_state(call) == LinphoneCallUpdatedByRemote) { + linphone_core_accept_call_update(lc, call, params); + } else { + linphone_core_update_call(lc, call, params); + } } linphone_call_params_destroy(params); } @@ -1026,7 +1034,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1); rtp_session_set_transports(call->videostream->session,vrtp,vrtcp); } - if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL)){ + if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (ice_session != NULL) && (ice_session_check_list(ice_session, 1))){ rtp_session_set_pktinfo(call->videostream->session, TRUE); call->videostream->ice_check_list = ice_session_check_list(ice_session, 1); ice_check_list_set_rtp_session(call->videostream->ice_check_list, call->videostream->session); @@ -1739,6 +1747,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ LinphoneCallParams *params; switch (call->state) { case LinphoneCallStreamsRunning: + case LinphoneCallUpdatedByRemote: if (evd->info.ice_processing_successful==TRUE) { ice_session_compute_candidates_foundations(ice_session); ice_session_eliminate_redundant_candidates(ice_session); @@ -1746,7 +1755,11 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ } params = linphone_call_params_copy(linphone_call_get_current_params(call)); linphone_call_params_enable_video(params, TRUE); - linphone_core_update_call(call->core, call, params); + if (call->state == LinphoneCallStreamsRunning) { + linphone_core_update_call(call->core, call, params); + } else { /* LinphoneCallUpdatedByRemote */ + linphone_core_accept_call_update(call->core, call, params); + } linphone_call_params_destroy(params); break; case LinphoneCallOutgoingInit: diff --git a/gtk/main.c b/gtk/main.c index 2955b3ec..05467765 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1080,11 +1080,7 @@ static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ static void on_call_updated_response(GtkWidget *dialog, gint responseid, LinphoneCall *call){ if (linphone_call_get_state(call)==LinphoneCallUpdatedByRemote){ - LinphoneCore *lc=linphone_call_get_core(call); - LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); - linphone_call_params_enable_video(params,responseid==GTK_RESPONSE_YES); - linphone_core_accept_call_update(lc,call,params); - linphone_call_params_destroy(params); + linphone_call_enable_video(call, responseid==GTK_RESPONSE_YES); } linphone_call_unref(call); g_source_remove_by_user_data(dialog); -- 2.39.2