diff --git a/plugins/janus_streaming.c b/plugins/janus_streaming.c index 07b8b3ce44..e473f2b581 100644 --- a/plugins/janus_streaming.c +++ b/plugins/janus_streaming.c @@ -6473,7 +6473,10 @@ static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp abase[0] = '\0'; int asport = 0, asport_rtcp = 0; multiple_fds audio_fds = {-1, -1}; - + + if(g_atomic_int_get(&mp->destroyed)){ + return -8; + } janus_mutex_lock(&mountpoints_mutex); /* Parse both video and audio first before proceed to setup as curldata will be reused */ int vresult = -1; @@ -7629,6 +7632,8 @@ static void *janus_streaming_relay_thread(void *data) { close(source->video_rtcp_fd); } source->video_rtcp_fd = -1; + if(g_atomic_int_get(&mountpoint->destroyed)) + break; /* Now let's try to reconnect */ if(janus_streaming_rtsp_connect_to_server(mountpoint) < 0) { /* Reconnection failed? Let's try again later */