app_confbridge/bridge_softmix: Add ability to force estimated bitrate

app_confbridge now has the ability to set the estimated bitrate on an
SFU bridge.  To use it, set a bridge profile's remb_behavior to "force"
and set remb_estimated_bitrate to a rate in bits per second.  The
remb_estimated_bitrate parameter is ignored if remb_behavior is something
other than "force".

Change-Id: Idce6464ff014a37ea3b82944452e56cc4d75ab0a
This commit is contained in:
George Joseph
2020-09-24 12:46:15 -06:00
parent 4b5ed817bd
commit 773f424c7f
8 changed files with 70 additions and 3 deletions

View File

@@ -1730,6 +1730,9 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST_ALL);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST_ALL);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_FORCE)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_FORCE);
ast_bridge_set_remb_estimated_bitrate(conference->bridge, conference->b_profile.remb_estimated_bitrate);
}
}

View File

@@ -533,8 +533,22 @@
<para>The highest estimated maximum bitrate of all receivers in the bridge
is taken and sent to each sender.</para>
</enum>
<enum name="force">
<para>The bitrate configured in <literal>remb_estimated_bitrate</literal>
is sent to each sender.</para>
</enum>
</enumlist>
</description>
<see-also><ref type="configOption">remb_estimated_bitrate</ref></see-also>
</configOption>
<configOption name="remb_estimated_bitrate">
<synopsis>Sets the estimated bitrate sent to each participant in REMB reports</synopsis>
<description><para>
When <literal>remb_behavior</literal> is set to <literal>force</literal>,
this options sets the estimated bitrate (in bits per second) sent to each participant
in REMB reports.
</para></description>
<see-also><ref type="configOption">remb_behavior</ref></see-also>
</configOption>
<configOption name="enable_events" default="no">
<synopsis>Enables events for this bridge</synopsis>
@@ -2159,7 +2173,9 @@ static int remb_behavior_handler(const struct aco_option *opt, struct ast_variab
BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST |
BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL |
BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL |
BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL);
BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL |
BRIDGE_OPT_REMB_BEHAVIOR_FORCE
);
if (!strcasecmp(var->value, "average")) {
ast_set_flag(b_profile, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE);
@@ -2173,6 +2189,8 @@ static int remb_behavior_handler(const struct aco_option *opt, struct ast_variab
ast_set_flag(b_profile, BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL);
} else if (!strcasecmp(var->value, "highest_all")) {
ast_set_flag(b_profile, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL);
} else if (!strcasecmp(var->value, "force")) {
ast_set_flag(b_profile, BRIDGE_OPT_REMB_BEHAVIOR_FORCE);
} else {
return -1;
}
@@ -2419,6 +2437,7 @@ int conf_load_config(void)
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));
aco_option_register_custom(&cfg_info, "remb_behavior", ACO_EXACT, bridge_types, "average", remb_behavior_handler, 0);
aco_option_register(&cfg_info, "remb_estimated_bitrate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_estimated_bitrate));
aco_option_register(&cfg_info, "enable_events", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_ENABLE_EVENTS);
/* 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);

View File

@@ -87,6 +87,7 @@ enum bridge_profile_flags {
BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL = (1 << 12), /*!< The average of all REMB reports in the entire bridge is sent to each sender */
BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL = (1 << 13), /*!< The lowest estimated maximum bitrate from all receivers is sent to each sender */
BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL = (1 << 14), /*!< The highest estimated maximum bitrate from all receivers is sent to each sender */
BRIDGE_OPT_REMB_BEHAVIOR_FORCE = (1 << 15), /*!< Force the REMB estimated bitrate to that specifiec in remb_estimated_bitrate */
};
enum conf_menu_action_id {
@@ -235,6 +236,7 @@ struct bridge_profile {
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 */
unsigned int remb_estimated_bitrate; /*!< Bitrate sent when BRIDGE_OPT_REMB_BEHAVIOR_FORCE is set */
};
/*! \brief The structure that represents a conference bridge */