Commit 6e7d8550 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix ice bug in rtcp-mux mode

parent 2e56ba2a
......@@ -4156,10 +4156,24 @@ static void change_ice_media_destinations(LinphoneCall *call) {
}
}
static void linphone_call_on_ice_gathering_finished(LinphoneCall *call){
int ping_time;
const SalMediaDescription *rmd = sal_call_get_remote_media_description(call->op);
if (rmd){
linphone_call_clear_unused_ice_candidates(call, rmd);
}
ice_session_compute_candidates_foundations(call->ice_session);
ice_session_eliminate_redundant_candidates(call->ice_session);
ice_session_choose_default_candidates(call->ice_session);
ping_time = ice_session_average_gathering_round_trip_time(call->ice_session);
if (ping_time >=0) {
call->ping_time=ping_time;
}
}
static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
OrtpEventType evt=ortp_event_get_type(ev);
OrtpEventData *evd=ortp_event_get_data(ev);
int ping_time;
if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) {
LinphoneCallParams *params = linphone_call_params_copy(call->current_params);
......@@ -4204,13 +4218,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
} else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) {
if (evd->info.ice_processing_successful==TRUE) {
ice_session_compute_candidates_foundations(call->ice_session);
ice_session_eliminate_redundant_candidates(call->ice_session);
ice_session_choose_default_candidates(call->ice_session);
ping_time = ice_session_average_gathering_round_trip_time(call->ice_session);
if (ping_time >=0) {
call->ping_time=ping_time;
}
linphone_call_on_ice_gathering_finished(call);
} else {
ms_warning("No STUN answer from [%s], disabling ICE",linphone_core_get_stun_server(call->core));
linphone_call_delete_ice_session(call);
......
......@@ -928,6 +928,22 @@ static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed){
call->textstream->ms.ice_check_list=NULL;
}
void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md){
int i;
if (!call->localdesc) return;
for (i = 0; i < md->nb_streams; i++) {
const SalStreamDescription *local_stream = &call->localdesc->streams[i];
const SalStreamDescription *stream = &md->streams[i];
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (!cl || !local_stream) continue;
if (stream->rtcp_mux && local_stream->rtcp_mux){
ice_check_list_remove_rtcp_candidates(cl);
}
}
}
void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md)
{
const SalStreamDescription *stream;
......@@ -1047,12 +1063,16 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
}
}
for (i = 0; i < md->nb_streams; i++) {
stream = &md->streams[i];
cl = ice_session_check_list(call->ice_session, i);
if (!sal_stream_description_active(&md->streams[i]) && (cl != NULL)) {
if (!cl) continue;
if (!sal_stream_description_active(stream)) {
ice_session_remove_check_list_from_idx(call->ice_session, i);
clear_ice_check_list(call, cl);
}
}
linphone_call_clear_unused_ice_candidates(call, md);
ice_session_check_mismatch(call->ice_session);
} else {
/* Response from remote does not contain mandatory ICE attributes, delete the session. */
......
......@@ -455,6 +455,7 @@ void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDes
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session);
void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call);
void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md);
void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md);
bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md);
void linphone_core_send_initial_subscribes(LinphoneCore *lc);
......
mediastreamer2 @ cdd6eb1f
Subproject commit ecba8b90c533c609d2e8e1ebf7aef6eaeb8df801
Subproject commit cdd6eb1f2684982f01a9650e8a3fe6c89011d156
......@@ -5529,8 +5529,6 @@ static void _call_with_rtcp_mux(bool_t caller_rtcp_mux, bool_t callee_rtcp_mux,
if (with_ice){
check_ice(marie, pauline, LinphoneIceStateHostConnection);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2));
}
liblinphone_tester_check_rtcp(marie,pauline);
......@@ -5562,8 +5560,8 @@ static void call_with_rtcp_mux_not_accepted(void){
}
static void call_with_ice_and_rtcp_mux(void){
/*skipped until ICE is modified to support rtcp-mux*/
/*_call_with_rtcp_mux(TRUE, TRUE, TRUE);*/
_call_with_rtcp_mux(TRUE, TRUE, TRUE);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment