]> sjero.net Git - linphone/commitdiff
Defer acceptation of video activation to gather ICE candidates if ICE is enabled.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 2 Aug 2012 10:16:25 +0000 (12:16 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 2 Aug 2012 10:16:25 +0000 (12:16 +0200)
coreapi/linphonecall.c
gtk/main.c

index b604c9de1a90ae3b3858595c24d6be0a732a7201..19e64b0966b4678939371f6e370826de4158ef72 100644 (file)
@@ -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:
index 2955b3ecc81493aa57330b608772f3e1e63137dd..054677654554366c3c175b42924641cb9e01bf1c 100644 (file)
@@ -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);