FS-10803: [mod_conference] Add support for alternate video layout config per conference profile #resolve

This commit is contained in:
Anthony Minessale 2017-11-21 18:40:59 -06:00 committed by Muteesa Fred
parent 2b5b9341e7
commit b8744e4c6d
5 changed files with 41 additions and 8 deletions

View File

@ -2269,6 +2269,7 @@ switch_status_t conference_api_sub_vid_res_id(conference_member_t *member, switc
switch_status_t conference_api_sub_vid_role_id(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
char *text = (char *) data;
int force = 0;
if (member == NULL)
return SWITCH_STATUS_GENERR;
@ -2282,7 +2283,12 @@ switch_status_t conference_api_sub_vid_role_id(conference_member_t *member, swit
return SWITCH_STATUS_SUCCESS;
}
if (zstr(text) || !strcasecmp(text, "clear") || (member->video_role_id && !strcasecmp(text, member->video_role_id))) {
if (!zstr(text) && *text == '=') {
text++;
force = 1;
}
if (zstr(text) || !strcasecmp(text, "clear") || (!force && member->video_role_id && !strcasecmp(text, member->video_role_id))) {
member->video_role_id = NULL;
stream->write_function(stream, "+OK role_id cleared\n");
} else {

View File

@ -1079,7 +1079,6 @@ void conference_member_set_floor_holder(conference_obj_t *conference, conference
member = lmember = conference_member_get(conference, id);
}
if (member) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding floor %s\n",
switch_channel_get_name(member->channel));

View File

@ -85,8 +85,8 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "conference_name", conference->name);
if (!(cxml = switch_xml_open_cfg("conference_layouts.conf", &cfg, params))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", "conference_layouts.conf");
if (!(cxml = switch_xml_open_cfg(conference->video_layout_conf, &cfg, params))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", conference->video_layout_conf);
goto done;
}
@ -272,6 +272,9 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
vlayout->layers++;
}
if (!conference->default_layout_name) {
conference->default_layout_name = switch_core_strdup(conference->pool, name);
}
switch_core_hash_insert(conference->layout_hash, name, vlayout);
if (!COMPLETE_INIT) {
@ -4526,10 +4529,17 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_
}
if (member && member->video_reservation_id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Setting floor not allowed on a member with a res id\n");
/* no video floor when a reservation id is set */
return;
}
if (member && member->video_role_id) {
/* no video floor when a role id is set */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Setting floor not allowed on a member with a role id\n");
return;
}
if ((!force && conference_utils_test_flag(conference, CFLAG_VID_FLOOR_LOCK))) {
return;
}

View File

@ -306,7 +306,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
//(!conference_utils_test_flag(conference, CFLAG_VID_FLOOR) || switch_channel_test_flag(channel, CF_VIDEO))) {
conference_member_set_floor_holder(conference, imember, 0);
floor_holder = imember->id;
floor_holder = conference->floor_holder;
}
video_media_flow = switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO);
@ -2642,6 +2642,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
char *perpetual_sound = NULL;
char *moh_sound = NULL;
char *outcall_templ = NULL;
char *video_layout_conf = NULL;
char *video_layout_name = NULL;
char *video_layout_group = NULL;
char *video_canvas_size = NULL;
@ -2825,6 +2826,8 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
outcall_templ = val;
} else if (!strcasecmp(var, "video-layout-name") && !zstr(val)) {
video_layout_name = val;
} else if (!strcasecmp(var, "video-layout-conf") && !zstr(val)) {
video_layout_conf = val;
} else if (!strcasecmp(var, "video-canvas-count") && !zstr(val)) {
video_canvas_count = atoi(val);
} else if (!strcasecmp(var, "video-super-canvas-label-layers") && !zstr(val)) {
@ -3064,6 +3067,10 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
/* Set defaults and various paramaters */
if (zstr(video_layout_conf)) {
video_layout_conf = "conference_layouts.conf";
}
/* Timer module to use */
if (zstr(timer_name)) {
timer_name = "soft";
@ -3110,6 +3117,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
}
conference->video_layout_conf = switch_core_strdup(conference->pool, video_layout_conf);
conference->comfort_noise_level = comfort_noise_level;
conference->pin_retries = pin_retries;
conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
@ -3242,6 +3250,14 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->video_layout_group = switch_core_strdup(conference->pool, video_layout_group);
}
if (!conference_video_get_layout(conference, video_layout_name, video_layout_group)) {
conference->video_layout_name = conference->video_layout_group = video_layout_group = video_layout_name = NULL;
if (conference_video_get_layout(conference, conference->default_layout_name, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Defaulting to layout %s\n", conference->default_layout_name);
video_layout_name = conference->video_layout_name = conference->default_layout_name;
}
}
if (!conference_video_get_layout(conference, video_layout_name, video_layout_group)) {
conference->video_layout_name = conference->video_layout_group = video_layout_group = video_layout_name = NULL;
conference->conference_video_mode = CONF_VIDEO_MODE_TRANSCODE;

View File

@ -628,6 +628,7 @@ typedef struct conference_obj {
int auto_record_canvas;
char *record_filename;
char *outcall_templ;
char *video_layout_conf;
char *video_layout_name;
char *video_layout_group;
char *video_canvas_bgcolor;
@ -755,6 +756,7 @@ typedef struct conference_obj {
char *scale_h264_canvas_bandwidth;
uint32_t moh_wait;
uint32_t floor_holder_score_iir;
char *default_layout_name;
} conference_obj_t;
/* Relationship with another member */