Defer acceptation of video activation to gather ICE candidates if ICE is enabled.

This commit is contained in:
Ghislain MARY 2012-08-02 12:16:25 +02:00
parent e5103d7a76
commit 65c46c6cb8
2 changed files with 18 additions and 9 deletions

View 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:

View 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);