From 5000443f708ddc7821381d4f24e7ce840727d325 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Tue, 14 Nov 2006 13:35:20 +0000 Subject: Fixed transport detachment when there's no thread being used in siprtp. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@800 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/samples/siprtp.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c index 49494b88..4fc236ed 100644 --- a/pjsip-apps/src/samples/siprtp.c +++ b/pjsip-apps/src/samples/siprtp.c @@ -1442,17 +1442,21 @@ static void destroy_call_media(unsigned call_index) { struct media_stream *audio = &app.call[call_index].media[0]; - if (audio->thread) { - + if (audio) { audio->active = PJ_FALSE; - audio->thread_quit_flag = 1; - pj_thread_join(audio->thread); - pj_thread_destroy(audio->thread); - audio->thread = NULL; - audio->thread_quit_flag = 0; + if (audio->thread) { + audio->thread_quit_flag = 1; + pj_thread_join(audio->thread); + pj_thread_destroy(audio->thread); + audio->thread = NULL; + audio->thread_quit_flag = 0; + } - pjmedia_transport_detach(audio->transport, audio); + if (audio->transport) { + pjmedia_transport_detach(audio->transport, audio); + audio->transport = NULL; + } } } -- cgit v1.2.3