From 9140aba9f9e9a4e64279f9a911dd034fdfe075ec Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Mar 2018 11:33:23 -0500 Subject: [PATCH] Revert "FS-11057: [mod_conference] CPU race on personal canvas #resolve" This reverts commit 7acc94be97c405941481bfc8f7b8159c63372968. --- .../mod_conference/conference_api.c | 21 +++++++------------ .../mod_conference/conference_member.c | 10 +-------- .../mod_conference/conference_video.c | 8 +++---- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 46d1798ed9..d8341361b2 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -1418,8 +1418,13 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s float sdiv = 0; int fdiv = 0; int force_w = 0, force_h = 0; - conference_member_t *imember; - + + + if (!conference_utils_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING)) { + stream->write_function(stream, "-ERR Bandwidth control not available.\n"); + return SWITCH_STATUS_SUCCESS; + } + if (!argv[2]) { stream->write_function(stream, "-ERR Invalid input\n"); return SWITCH_STATUS_SUCCESS; @@ -1480,18 +1485,6 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s } switch_mutex_lock(conference->member_mutex); - - for (imember = conference->members; imember; imember = imember->next) { - - if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY)) { - continue; - } - - switch_core_media_set_outgoing_bitrate(imember->session, SWITCH_MEDIA_TYPE_VIDEO, video_write_bandwidth); - - stream->write_function(stream, "+OK Set Bandwidth %d kps for member %s\n", video_write_bandwidth, switch_channel_get_name(imember->channel)); - } - for (i = 0; i <= conference->canvas_count; i++) { if (i > -1 && i != id - 1) { continue; diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 79ebcfcc4f..274f274c52 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -806,8 +806,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m conference_video_reset_member_codec_index(member); if (has_video) { - int bitrate = conference->video_codec_settings.video.bandwidth; - if ((var = switch_channel_get_variable_dup(member->channel, "video_mute_png", SWITCH_FALSE, -1))) { member->video_mute_png = switch_core_strdup(member->pool, var); member->video_mute_img = switch_img_read_png(member->video_mute_png, SWITCH_IMG_FMT_I420); @@ -834,17 +832,11 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m if (member->max_bw_out < conference->video_codec_settings.video.bandwidth) { conference_utils_member_set_flag_locked(member, MFLAG_NO_MINIMIZE_ENCODING); - bitrate = member->max_bw_out; + switch_core_media_set_outgoing_bitrate(member->session, SWITCH_MEDIA_TYPE_VIDEO, member->max_bw_out); } } - - if (bitrate) { - switch_core_media_set_outgoing_bitrate(member->session, SWITCH_MEDIA_TYPE_VIDEO, bitrate); - } - } - switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id); switch_channel_set_variable_printf(channel, "conference_moderator", "%s", conference_utils_member_test_flag(member, MFLAG_MOD) ? "true" : "false"); switch_channel_set_variable_printf(channel, "conference_ghost", "%s", conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false"); diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 110b5f0d54..7259fdb60f 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3783,8 +3783,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } if (layer && use_img) { - //switch_img_copy(use_img, &layer->cur_img); - conference_video_scale_and_patch(layer, use_img, SWITCH_FALSE); + switch_img_copy(use_img, &layer->cur_img); + conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE); } } @@ -3806,8 +3806,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_img_free(&layer->banner_img); switch_img_free(&layer->logo_img); layer->member_id = -1; - //switch_img_copy(img, &layer->cur_img); - conference_video_scale_and_patch(layer, img, SWITCH_FALSE); + switch_img_copy(img, &layer->cur_img); + conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE); } }