From ced1c7af225440ddc9b4387f01eaa4e57fe61705 Mon Sep 17 00:00:00 2001 From: Alessandro Toppi Date: Wed, 28 Aug 2019 15:31:39 +0200 Subject: [PATCH] Use a mutex around janus_streaming_rtsp_connect_to_server to avoid collisions on used ports. --- plugins/janus_streaming.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/janus_streaming.c b/plugins/janus_streaming.c index 2e36f3d6ba..0069d767ce 100644 --- a/plugins/janus_streaming.c +++ b/plugins/janus_streaming.c @@ -6127,10 +6127,13 @@ static void *janus_streaming_relay_thread(void *data) { } source->video_rtcp_fd = -1; /* Now let's try to reconnect */ + janus_mutex_lock(&mountpoints_mutex); if(janus_streaming_rtsp_connect_to_server(mountpoint) < 0) { /* Reconnection failed? Let's try again later */ JANUS_LOG(LOG_WARN, "[%s] Reconnection of the RTSP stream failed, trying again in a few seconds...\n", name); + janus_mutex_unlock(&mountpoints_mutex); } else { + janus_mutex_unlock(&mountpoints_mutex); /* We're connected, let's send a PLAY */ if(janus_streaming_rtsp_play(source) < 0) { /* Error trying to play? Let's try again later */