From e9f89d162ffd44c8e16e0b9f547db39885c6697e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 10 Feb 2015 15:11:32 +0100 Subject: [PATCH] do not unregister event queue while msticker is still running with the RtpSession. The stream must be first stopped, then queue can be destroyed safely --- coreapi/linphonecall.c | 14 ++++++-------- coreapi/linphonecore.c | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b6b6a3230..1535dc957 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2763,10 +2763,6 @@ static void linphone_call_stop_audio_stream(LinphoneCall *call) { if (call->audiostream!=NULL) { linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_AUDIO); media_stream_reclaim_sessions(&call->audiostream->ms,&call->sessions[0]); - rtp_session_unregister_event_queue(call->audiostream->ms.sessions.rtp_session,call->audiostream_app_evq); - ortp_ev_queue_flush(call->audiostream_app_evq); - ortp_ev_queue_destroy(call->audiostream_app_evq); - call->audiostream_app_evq=NULL; if (call->audiostream->ec){ const char *state_str=NULL; @@ -2782,6 +2778,9 @@ static void linphone_call_stop_audio_stream(LinphoneCall *call) { linphone_call_remove_from_conf(call); } audio_stream_stop(call->audiostream); + ortp_ev_queue_flush(call->audiostream_app_evq); + ortp_ev_queue_destroy(call->audiostream_app_evq); + call->audiostream_app_evq=NULL; call->audiostream=NULL; call->current_params->audio_codec = NULL; } @@ -2792,13 +2791,12 @@ static void linphone_call_stop_video_stream(LinphoneCall *call) { if (call->videostream!=NULL){ linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_VIDEO); media_stream_reclaim_sessions(&call->videostream->ms,&call->sessions[1]); - rtp_session_unregister_event_queue(call->videostream->ms.sessions.rtp_session,call->videostream_app_evq); - ortp_ev_queue_flush(call->videostream_app_evq); - ortp_ev_queue_destroy(call->videostream_app_evq); - call->videostream_app_evq=NULL; linphone_call_log_fill_stats(call->log,(MediaStream*)call->videostream); video_stream_stop(call->videostream); call->videostream=NULL; + ortp_ev_queue_flush(call->videostream_app_evq); + ortp_ev_queue_destroy(call->videostream_app_evq); + call->videostream_app_evq=NULL; call->current_params->video_codec = NULL; } #endif diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 848f25761..ffa2a6b32 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1075,6 +1075,7 @@ static bool_t get_codec(LinphoneCore *lc, SalStreamType type, int index, Payload pt->mime_type=ortp_strdup(mime); pt->clock_rate=rate; pt->channels=channels; + payload_type_set_number(pt,-1); /*dynamic assignment*/ payload_type_set_recv_fmtp(pt,fmtp); *default_list=ms_list_append(*default_list, pt); }