From 5913eff7a5ff4516c745669b6bedb87f367a84fa Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 17 Apr 2015 18:37:28 +0200 Subject: [PATCH] fix crash with ICE scenario --- coreapi/linphonecore.c | 2 +- coreapi/misc.c | 8 ++++++-- coreapi/private.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 93df26f22..ed8cae539 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3795,7 +3795,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, } linphone_call_update_remote_session_id_and_ver(call); - linphone_call_stop_ice_for_inactive_streams(call->localdesc, call->ice_session); + linphone_call_stop_ice_for_inactive_streams(call); sal_call_accept(call->op); linphone_core_notify_display_status(lc,_("Connected.")); lc->current_call=call; diff --git a/coreapi/misc.c b/coreapi/misc.c index 080175a6c..5f34b21ff 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -59,6 +59,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define RTP_HDR_SZ 12 #define IP4_HDR_SZ 20 /*20 is the minimum, but there may be some options*/ +static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed); bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const LinphonePayloadType *pt){ if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt)){ @@ -716,9 +717,11 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call) linphone_ice_state_to_string(call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state), linphone_ice_state_to_string(call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state)); } -void linphone_call_stop_ice_for_inactive_streams(SalMediaDescription *desc, IceSession *session) { +void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call) { int i; - + IceSession *session = call->ice_session; + SalMediaDescription *desc = call->localdesc; + if (session == NULL) return; if (ice_session_state(session) == IS_Completed) return; @@ -726,6 +729,7 @@ void linphone_call_stop_ice_for_inactive_streams(SalMediaDescription *desc, IceS IceCheckList *cl = ice_session_check_list(session, i); if (!sal_stream_description_active(&desc->streams[i]) && cl) { ice_session_remove_check_list(session, cl); + clear_ice_check_list(call, cl); } } } diff --git a/coreapi/private.h b/coreapi/private.h index a1751da5f..d53a7d780 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -396,7 +396,7 @@ void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, Linphone int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev); -void linphone_call_stop_ice_for_inactive_streams(SalMediaDescription *desc, IceSession *session); +void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call); 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);