app_confbridge / bridge_softmix: Add ability to configure REMB interval.
authorJoshua Colp <jcolp@digium.com>
Mon, 2 Apr 2018 13:53:17 +0000 (10:53 -0300)
committerJoshua Colp <jcolp@digium.com>
Tue, 3 Apr 2018 14:13:11 +0000 (08:13 -0600)
This change adds a configuration option to app_confbridge which can be
used to set the interval at which we will send a combined REMB (remote
estimated maximum bitrate) frame to sources of video. The bridging API
has also been extended slightly to allow setting this so bridge_softmix
can use it.

ASTERISK-27786

Change-Id: I0e49eae60f369c86434414f3cb8278709c793c82

apps/app_confbridge.c
apps/confbridge/conf_config_parser.c
apps/confbridge/include/confbridge.h
configs/samples/confbridge.conf.sample
include/asterisk/bridge.h
main/bridge.c

index 4f1108e..d8407d8 100644 (file)
@@ -1543,6 +1543,7 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
                } else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_SFU)) {
                        ast_bridge_set_sfu_video_mode(conference->bridge);
                        ast_bridge_set_video_update_discard(conference->bridge, conference->b_profile.video_update_discard);
+                       ast_bridge_set_remb_send_interval(conference->bridge, conference->b_profile.remb_send_interval);
                }
 
                /* Link it into the conference bridges container */
index 71da802..f9d7483 100644 (file)
                                                video update requests from clients.
                                        </para></description>
                                </configOption>
+                               <configOption name="remb_send_interval" default="0">
+                                       <synopsis>Sets the interval in milliseconds that a combined REMB frame will be sent to video sources</synopsis>
+                                       <description><para>
+                                               Sets the interval in milliseconds that a combined REMB frame will be sent
+                                               to video sources. This is done by taking all REMB frames that have been
+                                               received since the last REMB frame was sent, making a combined value,
+                                               and sending it to the source. A REMB frame contains receiver estimated
+                                               maximum bitrate information. By creating a combined REMB frame the
+                                               sender of video can be influenced on the bitrate they choose, allowing
+                                               better quality for all receivers.
+                                       </para></description>
+                               </configOption>
                                <configOption name="template">
                                        <synopsis>When using the CONFBRIDGE dialplan function, use a bridge profile as a template for creating a new temporary profile</synopsis>
                                </configOption>
@@ -1661,6 +1673,7 @@ static char *handle_cli_confbridge_show_bridge_profile(struct ast_cli_entry *e,
        }
 
        ast_cli(a->fd,"Video Update Discard: %u\n", b_profile.video_update_discard);
+       ast_cli(a->fd,"REMB Send Interval: %u\n", b_profile.remb_send_interval);
 
        ast_cli(a->fd,"sound_only_person:    %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
        ast_cli(a->fd,"sound_only_one:       %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
@@ -2231,6 +2244,7 @@ int conf_load_config(void)
        aco_option_register(&cfg_info, "language", ACO_EXACT, bridge_types, "en", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, language));
        aco_option_register_custom(&cfg_info, "sound_", ACO_PREFIX, bridge_types, NULL, sound_option_handler, 0);
        aco_option_register(&cfg_info, "video_update_discard", ACO_EXACT, bridge_types, "2000", OPT_UINT_T, 0, FLDSET(struct bridge_profile, video_update_discard));
+       aco_option_register(&cfg_info, "remb_send_interval", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_send_interval));
        /* This option should only be used with the CONFBRIDGE dialplan function */
        aco_option_register_custom(&cfg_info, "template", ACO_EXACT, bridge_types, NULL, bridge_template_handler, 0);
 
index 044ab40..c2f8f9a 100644 (file)
@@ -222,6 +222,7 @@ struct bridge_profile {
        struct bridge_profile_sounds *sounds;
        char regcontext[AST_MAX_CONTEXT];
        unsigned int video_update_discard; /*!< Amount of time after sending a video update request that subsequent requests should be discarded */
+       unsigned int remb_send_interval; /*!< Interval at which a combined REMB frame is sent to video sources */
 };
 
 /*! \brief The structure that represents a conference bridge */
index e2d8a62..4028593 100644 (file)
@@ -235,6 +235,10 @@ type=bridge
                            ; the video stream. Since a full frame can be large limiting how often they occur can
                            ; reduce bandwidth usage at the cost of increasing how long it may take a newly joined
                            ; channel to receive the video stream.
+;remb_send_interval=1000   ; Interval (in milliseconds) at which a combined REMB frame will be sent to sources of video.
+                           ; A REMB frame contains receiver estimated maximum bitrate information. By creating a combined
+                           ; frame and sending it to the sources of video the sender can be influenced on what bitrate
+                           ; they choose allowing a better experience for the receivers. This defaults to 0, or disabled.
 
 ; All sounds in the conference are customizable using the bridge profile options below.
 ; Simply state the option followed by the filename or full path of the filename after
index 8d5c502..b232558 100644 (file)
@@ -135,6 +135,7 @@ struct ast_bridge_video_mode {
                struct ast_bridge_video_talker_src_data talker_src_data;
        } mode_data;
        unsigned int video_update_discard;
+       unsigned int remb_send_interval;
 };
 
 /*!
@@ -912,6 +913,14 @@ void ast_bridge_set_sfu_video_mode(struct ast_bridge *bridge);
 void ast_bridge_set_video_update_discard(struct ast_bridge *bridge, unsigned int video_update_discard);
 
 /*!
+ * \brief Set the interval at which a combined REMB frame will be sent to video sources
+ *
+ * \param bridge Bridge to set the REMB send interval on
+ * \param remb_send_interval The REMB send interval
+ */
+void ast_bridge_set_remb_send_interval(struct ast_bridge *bridge, unsigned int remb_send_interval);
+
+/*!
  * \brief Update information about talker energy for talker src video mode.
  */
 void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyfame);
index 1109c4b..93c53dd 100644 (file)
@@ -3850,6 +3850,13 @@ void ast_bridge_set_video_update_discard(struct ast_bridge *bridge, unsigned int
        ast_bridge_unlock(bridge);
 }
 
+void ast_bridge_set_remb_send_interval(struct ast_bridge *bridge, unsigned int remb_send_interval)
+{
+       ast_bridge_lock(bridge);
+       bridge->softmix.video_mode.remb_send_interval = remb_send_interval;
+       ast_bridge_unlock(bridge);
+}
+
 void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyframe)
 {
        struct ast_bridge_video_talker_src_data *data;