From fa7f10c02b6d01f53be0d9c488b9cada88c2eafa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 1 Mar 2017 14:27:41 -0600 Subject: [PATCH] FS-10079: [mod_conference] Possible lockup when sending many commands to conference at once #resolve --- src/mod/applications/mod_conference/conference_file.c | 7 ++++--- src/mod/applications/mod_conference/conference_video.c | 3 ++- src/mod/applications/mod_conference/mod_conference.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_file.c b/src/mod/applications/mod_conference/conference_file.c index e64ac1dd86..0c125cd7a4 100644 --- a/src/mod/applications/mod_conference/conference_file.c +++ b/src/mod/applications/mod_conference/conference_file.c @@ -160,11 +160,11 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u return SWITCH_STATUS_NOTFOUND; } - switch_mutex_lock(conference->mutex); + switch_mutex_lock(conference->member_mutex); count = conference->count; switch_mutex_unlock(conference->member_mutex); - switch_mutex_unlock(conference->mutex); + if (!count) { return SWITCH_STATUS_FALSE; @@ -316,7 +316,8 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u fnode->file = switch_core_strdup(fnode->pool, file); if (!conference->fnode || (async && !conference->async_fnode)) { - conference_video_fnode_check(fnode, -1); + fnode->new_fnode = 1; + //conference_video_fnode_check(fnode, -1); } /* Queue the node */ diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 9cc7d6c4ad..faf662e091 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3123,7 +3123,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_mutex_unlock(conference->member_mutex); } else { - + switch_mutex_lock(conference->file_mutex); if (conference->async_fnode && (conference->async_fnode->canvas_id == canvas->canvas_id || conference->async_fnode->canvas_id == -1)) { if (conference->async_fnode->layer_id > -1) { conference_video_patch_fnode(canvas, conference->async_fnode); @@ -3139,6 +3139,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr conference_video_fnode_check(conference->fnode, canvas->canvas_id); } } + switch_mutex_unlock(conference->file_mutex); if (!conference->playing_video_file) { for (i = 0; i < canvas->total_layers; i++) { diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index 24efb81186..aa20997488 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -387,6 +387,7 @@ typedef struct conference_file_node { struct conference_obj *conference; char *res_id; int loops; + int new_fnode; } conference_file_node_t; typedef enum {