]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10803: [mod_conference] Add support for alternate video layout config per conferen...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 22 Nov 2017 00:40:59 +0000 (18:40 -0600)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:36 +0000 (07:21 +0000)
src/mod/applications/mod_conference/conference_api.c
src/mod/applications/mod_conference/conference_member.c
src/mod/applications/mod_conference/conference_video.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_conference/mod_conference.h

index c8fa1eca6c17d3d0329405b261515e53262a3040..1f8d586e647c0002868fb48e818afba977433fe6 100644 (file)
@@ -2269,7 +2269,8 @@ 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;
 
@@ -2281,8 +2282,13 @@ switch_status_t conference_api_sub_vid_role_id(conference_member_t *member, swit
                stream->write_function(stream, "-ERR conference is not in mixing mode\n");
                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 {
index f971134119bb95e5a6bc27d271b005ecc7abf744..e55b068416751f9bd7ce937d480b73ebead639c2 100644 (file)
@@ -1065,7 +1065,7 @@ void conference_member_set_floor_holder(conference_obj_t *conference, conference
        conference_member_t *lmember = NULL;
 
        conference->floor_holder_score_iir = 0;
-       
+
        if (conference->floor_holder) {
                if ((member && conference->floor_holder == member->id) || (id && conference->floor_holder == id)) {
                        goto end;
@@ -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));
index 97ae8d1d6edf2f4a1cd2ec0501887c56e2b67dcc..6fa1c7dc7c356e9f84a921fff978e44926194dfb 100644 (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;
        }
index 95fdfc03aca02b58c6adf3821cd260e0f752996e..eadf6c22a9ee524875a3c36ec2b63130566b004d 100644 (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;
index ff15c7329e25a43708693de30102318067c53b75..5f83db4db2ae30203b992b4563f3b03ea3073916 100644 (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 */