Skip to content

Commit

Permalink
Fix deadlock when destroying RTSP mountpoint while reconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelnicolas committed Jun 14, 2021
1 parent 9195ee4 commit e60930f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -6489,14 +6489,18 @@ static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp
int asport = 0, asport_rtcp = 0;
multiple_fds audio_fds = {-1, -1};

if(g_atomic_int_get(&mp->destroyed)) {
curl_easy_cleanup(curl);
g_free(curldata->buffer);
g_free(curldata);
return -8;
while (!janus_mutex_trylock(&mountpoints_mutex)) {
if(g_atomic_int_get(&mp->destroyed)) {
JANUS_LOG(LOG_WARN, "[%s] Destroying mountpoint while trying to reconnect, aborting\n", mp->name);
curl_easy_cleanup(curl);
g_free(curldata->buffer);
g_free(curldata);
return -8;
}

g_usleep(1000);
}

janus_mutex_lock(&mountpoints_mutex);
/* Parse both video and audio first before proceed to setup as curldata will be reused */
int vresult = -1;
if(dovideo) {
Expand Down

0 comments on commit e60930f

Please sign in to comment.