]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8293 make conference video quality configurable with video-quality param NEEDS DOC
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 25 Nov 2015 22:01:34 +0000 (16:01 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 25 Nov 2015 22:01:34 +0000 (16:01 -0600)
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 a31c76966d3a166199d12647ed4c61f19fa999e4..a540b06cc1ab713ba11662d0d882ba632a526737 100644 (file)
@@ -1923,7 +1923,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_
                        int max = 0;
 
                        if (layer) {
-                               kps = switch_calc_bitrate(w, h, 2, (int)(member->conference->video_fps.fps));
+                               kps = switch_calc_bitrate(w, h, member->conference->video_quality, (int)(member->conference->video_fps.fps));
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s auto-setting bitrate to %dkps to accomodate %dx%d resolution\n",
                                                                  switch_channel_get_name(member->channel), kps, layer->screen_w, layer->screen_h);
                        }
index 2546112ff7c5e77700063f0f7653fba6986aa568..f9c9fc68c9a5acfd9e8ea5560df382dd6c6df86e 100644 (file)
@@ -2410,6 +2410,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
        char *video_codec_bandwidth = NULL;
        char *no_video_avatar = NULL;
        conference_video_mode_t conference_video_mode = CONF_VIDEO_MODE_PASSTHROUGH;
+       int conference_video_quality = 1;
        float fps = 15.0f;
        uint32_t max_members = 0;
        uint32_t announce_count = 0;
@@ -2721,6 +2722,15 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
                                terminate_on_silence = val;
                        } else if (!strcasecmp(var, "endconf-grace-time") && !zstr(val)) {
                                endconference_grace_time = val;
+                       } else if (!strcasecmp(var, "video-quality") && !zstr(val)) {
+                               int tmp = atoi(val);
+
+                               if (tmp > 0 && tmp < 5) {
+                                       conference_video_quality = tmp;
+                               } else {
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Video quality must be between 1 and 4\n");
+                               }
+                               
                        } else if (!strcasecmp(var, "video-mode") && !zstr(val)) {
                                if (!strcasecmp(val, "passthrough")) {
                                        conference_video_mode = CONF_VIDEO_MODE_PASSTHROUGH;
@@ -2789,8 +2799,8 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
        conference->caller_controls = switch_core_strdup(conference->pool, caller_controls);
        conference->moderator_controls = switch_core_strdup(conference->pool, moderator_controls);
        conference->broadcast_chat_messages = broadcast_chat_messages;
-
-
+       conference->video_quality = conference_video_quality;
+       
        conference->conference_video_mode = conference_video_mode;
 
        if (!switch_core_has_video() && (conference->conference_video_mode == CONF_VIDEO_MODE_MUX || conference->conference_video_mode == CONF_VIDEO_MODE_TRANSCODE)) {
@@ -2864,7 +2874,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
 
                if (video_codec_bandwidth) {
                        if (!strcasecmp(video_codec_bandwidth, "auto")) {
-                               conference->video_codec_settings.video.bandwidth = switch_calc_bitrate(canvas_w, canvas_h, 2, (int)conference->video_fps.fps);
+                               conference->video_codec_settings.video.bandwidth = switch_calc_bitrate(canvas_w, canvas_h, conference->video_quality, (int)conference->video_fps.fps);
                        } else {
                                conference->video_codec_settings.video.bandwidth = switch_parse_bandwidth_string(video_codec_bandwidth);
                        }
index 4ad382d8dd5a2317184b0d533e0595cf8b78e1ee..7c9793686b1b3bece5ede2885ed73dbdead1b89f 100644 (file)
@@ -560,6 +560,7 @@ typedef struct conference_obj {
        char *video_letterbox_bgcolor;
        char *no_video_avatar;
        conference_video_mode_t conference_video_mode;
+       int video_quality;
        int members_with_video;
        int members_with_avatar;
        switch_codec_settings_t video_codec_settings;