diff --git a/plugins/janus_streaming.c b/plugins/janus_streaming.c index fec9078d3c..3fde74ff76 100644 --- a/plugins/janus_streaming.c +++ b/plugins/janus_streaming.c @@ -8402,6 +8402,44 @@ static void *janus_streaming_relay_thread(void *data) { } } + /* Close the ports we bound to */ + if(source->audio_fd > -1) { + close(source->audio_fd); + source->audio_fd = -1; + } + if(source->video_fd[0] > -1) { + close(source->video_fd[0]); + source->video_fd[0] = -1; + } + if(source->video_fd[1] > -1) { + close(source->video_fd[1]); + source->video_fd[1] = -1; + } + if(source->video_fd[2] > -1) { + close(source->video_fd[2]); + source->video_fd[2] = -1; + } + if(source->data_fd > -1) { + close(source->data_fd); + source->data_fd = -1; + } + if(source->audio_rtcp_fd > -1) { + close(source->audio_rtcp_fd); + source->audio_rtcp_fd = -1; + } + if(source->video_rtcp_fd > -1) { + close(source->video_rtcp_fd); + source->video_rtcp_fd = -1; + } + if(source->pipefd[0] > -1) { + close(source->pipefd[0]); + source->pipefd[0] = -1; + } + if(source->pipefd[1] > -1) { + close(source->pipefd[1]); + source->pipefd[1] = -1; + } + /* Notify users this mountpoint is done */ janus_mutex_lock(&mountpoint->mutex); GList *viewer = g_list_first(mountpoint->viewers);