diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 93ca89baa9..72422436fc 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -103,7 +103,8 @@ api_command_t conference_api_sub_commands[] = { {"vid-write-png", (void_fn_t) & conference_api_sub_write_png, CONF_API_SUB_ARGS_SPLIT, "vid-write-png", ""}, {"vid-fps", (void_fn_t) & conference_api_sub_vid_fps, CONF_API_SUB_ARGS_SPLIT, "vid-fps", ""}, {"vid-bgimg", (void_fn_t) & conference_api_sub_canvas_bgimg, CONF_API_SUB_ARGS_SPLIT, "vid-bgimg", " | clear []"}, - {"vid-bandwidth", (void_fn_t) & conference_api_sub_vid_bandwidth, CONF_API_SUB_ARGS_SPLIT, "vid-bandwidth", ""} + {"vid-bandwidth", (void_fn_t) & conference_api_sub_vid_bandwidth, CONF_API_SUB_ARGS_SPLIT, "vid-bandwidth", ""}, + {"vid-personal", (void_fn_t) & conference_api_sub_vid_personal, CONF_API_SUB_ARGS_SPLIT, "vid-personal", "[on|off]"} }; switch_status_t conference_api_sub_pause_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) @@ -1000,6 +1001,29 @@ switch_status_t conference_api_sub_volume_out(conference_member_t *member, switc return SWITCH_STATUS_SUCCESS; } +switch_status_t conference_api_sub_vid_personal(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + int on = 0; + + if (!conference->canvases[0]) { + stream->write_function(stream, "-ERR conference is not in mixing mode\n"); + return SWITCH_STATUS_SUCCESS; + } + + if (argv[2]) { + on = switch_true(argv[2]); + if (on) { + conference_utils_set_flag(conference, CFLAG_PERSONAL_CANVAS); + } else { + conference_utils_clear_flag(conference, CFLAG_PERSONAL_CANVAS); + } + } + + stream->write_function(stream, "+OK personal is %s\n", on ? "on" : "off"); + + return SWITCH_STATUS_SUCCESS; +} + switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { uint32_t i; diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 36344a815d..9f3fd8a89f 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -708,15 +708,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m switch_queue_create(&member->dtmf_queue, 100, member->pool); - if (conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { - video_layout_t *vlayout = NULL; - - if ((vlayout = conference_video_get_layout(conference, conference->video_layout_name, conference->video_layout_group))) { - conference_video_init_canvas(conference, vlayout, &member->canvas); - conference_video_init_canvas_layers(conference, member->canvas, vlayout); - } - } - conference->members = member; conference_utils_member_set_flag_locked(member, MFLAG_INTREE); switch_mutex_unlock(conference->member_mutex); diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index db57c03bb6..08e8f050c8 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -2055,6 +2055,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr int last_file_count = 0; int layout_applied = 0; int files_playing = 0; + int last_personal = conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS) ? 1 : 0; canvas->video_timer_reset = 1; @@ -2068,9 +2069,9 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr int file_count = 0, check_async_file = 0, check_file = 0; switch_image_t *async_file_img = NULL, *normal_file_img = NULL, *file_imgs[2] = { 0 }; switch_frame_t file_frame = { 0 }; - int j = 0; - - if (!conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { + int j = 0, personal = conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS) ? 1 : 0; + + if (!personal) { switch_mutex_lock(canvas->mutex); if (canvas->new_vlayout) { conference_video_init_canvas_layers(conference, canvas, NULL); @@ -2094,6 +2095,12 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr now = switch_micro_time_now(); + if (last_personal != personal) { + do_refresh = 100; + count_changed = 1; + last_personal = personal; + } + if (members_with_video != conference->members_with_video) { do_refresh = 100; count_changed = 1; @@ -2103,7 +2110,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr count_changed = 1; } - if (count_changed && !conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { + if (count_changed && !personal) { layout_group_t *lg = NULL; video_layout_t *vlayout = NULL; int canvas_count = 0; @@ -2189,7 +2196,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr int i; if (!imember->session || (!switch_channel_test_flag(imember->channel, CF_VIDEO_READY) && !imember->avatar_png_img) || - conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS) || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { + personal || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; } @@ -2397,7 +2404,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_mutex_unlock(conference->member_mutex); - if (conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { + if (personal) { layout_group_t *lg = NULL; video_layout_t *vlayout = NULL; conference_member_t *omember; @@ -2425,6 +2432,13 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr conference_video_init_canvas_layers(conference, imember->canvas, conference->new_personal_vlayout); layout_applied++; } + + if (!imember->canvas) { + if ((vlayout = conference_video_get_layout(conference, conference->video_layout_name, conference->video_layout_group))) { + conference_video_init_canvas(conference, vlayout, &imember->canvas); + conference_video_init_canvas_layers(conference, imember->canvas, vlayout); + } + } if (switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) { switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ); diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index 83f7860307..9f0473b30e 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -1089,6 +1089,7 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch switch_status_t conference_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); +switch_status_t conference_api_sub_vid_personal(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn); switch_status_t conference_api_sub_syntax(char **syntax); switch_status_t conference_api_main_real(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream);