From 00f14981b400d11d9acdef249f13a8fdf272c3ee Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 29 Mar 2018 14:51:37 -0500 Subject: [PATCH] FS-11070: [mod_conference] Improve video bridge first two for mux mode -- add support for files playing in this mode #resolve --- .../mod_conference/conference_video.c | 39 ++++++++++++++----- .../mod_conference/mod_conference.h | 1 + 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 39cbe2cd2f..81f2fbc09d 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3108,13 +3108,6 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } - if (conference_utils_test_flag(conference, CFLAG_VIDEO_BRIDGE_FIRST_TWO)) { - if (conference->members_seeing_video < 3) { - switch_yield(20000); - continue; - } - } - video_count = 0; switch_mutex_lock(conference->file_mutex); @@ -3122,6 +3115,9 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr check_async_file = 1; file_count++; video_count++; + if (!files_playing) { + send_keyframe = 1; + } files_playing = 1; } @@ -3129,10 +3125,24 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr check_file = 1; file_count++; video_count++; + if (!files_playing) { + send_keyframe = 1; + } files_playing = 1; } switch_mutex_unlock(conference->file_mutex); + if (conference_utils_test_flag(conference, CFLAG_VIDEO_BRIDGE_FIRST_TWO)) { + if (conference->members_seeing_video < 3 && !file_count) { + conference->mux_paused = 1; + files_playing = 0; + switch_yield(20000); + continue; + } else { + conference->mux_paused = 0; + } + } + switch_mutex_lock(conference->member_mutex); watchers = 0; @@ -4872,7 +4882,8 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session, //char *name = switch_channel_get_name(channel); conference_member_t *member = (conference_member_t *)user_data; conference_relationship_t *rel = NULL, *last = NULL; - + int files_playing = 0; + switch_assert(member); if (switch_test_flag(frame, SFF_CNG) || !frame->packet) { @@ -4888,8 +4899,18 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session, } + switch_mutex_lock(member->conference->file_mutex); + if (member->conference->async_fnode && switch_core_file_has_video(&member->conference->async_fnode->fh, SWITCH_TRUE)) { + files_playing = 1; + } + + if (member->conference->fnode && switch_core_file_has_video(&member->conference->fnode->fh, SWITCH_TRUE)) { + files_playing = 1; + } + switch_mutex_unlock(member->conference->file_mutex); + if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_BRIDGE_FIRST_TWO)) { - if (member->conference->members_seeing_video < 3) { + if (member->conference->members_seeing_video < 3 && !files_playing && member->conference->mux_paused) { conference_video_write_frame(member->conference, member, frame); conference_video_check_recording(member->conference, NULL, frame); switch_thread_rwlock_unlock(member->conference->rwlock); diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index c87c7adaef..c4f7b14fba 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -762,6 +762,7 @@ typedef struct conference_obj { uint32_t moh_wait; uint32_t floor_holder_score_iir; char *default_layout_name; + int mux_paused; } conference_obj_t; /* Relationship with another member */