Defer sending of answer of re-invite when there are some ICE losing candidate pairs.

This commit is contained in:
Ghislain MARY 2012-08-08 13:14:06 +02:00
parent 3611187779
commit d3851711b1
2 changed files with 15 additions and 2 deletions

View file

@ -1785,6 +1785,15 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
}
break;
}
} else if (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED) {
SalMediaDescription *md;
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
sal_call_set_local_media_description(call->op,call->localdesc);
sal_call_accept(call->op);
md=sal_call_get_final_media_description(call->op);
if (md && !sal_media_description_empty(md))
linphone_core_update_streams (call->core,call,md);
linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
}
}
@ -1841,7 +1850,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
evd->packet = NULL;
if (lc->vtable.call_stats_updated)
lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]);
} else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)) {
} else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED)) {
handle_ice_events(call, ev);
}
ortp_event_destroy(ev);
@ -1881,7 +1890,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
evd->packet = NULL;
if (lc->vtable.call_stats_updated)
lc->vtable.call_stats_updated(lc, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]);
} else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)) {
} else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) || (evt == ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED)) {
handle_ice_events(call, ev);
}
ortp_event_destroy(ev);

View file

@ -2554,6 +2554,10 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const
update_local_media_description(lc,call);
if (call->ice_session != NULL) {
linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op));
if (ice_session_nb_losing_pairs(call->ice_session) > 0) {
/* Defer the sending of the answer until there are no losing pairs left. */
return 0;
}
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
}
sal_call_set_local_media_description(call->op,call->localdesc);