stasis_bridge.c: Fixed wrong video_mode shown

Currently, if the bridge has created by the ARI, the video_mode
parameter was
not shown in the BridgeCreated event correctly.

Fixed it and added video_mode shown in the 'bridge show <bridge id>'
cli.

ASTERISK-28987

Change-Id: I8c205126724e34c2bdab9380f523eb62478e4295
This commit is contained in:
sungtae kim
2020-07-11 01:14:53 +02:00
committed by George Joseph
parent 7892bdec53
commit 15a3318f1f
4 changed files with 20 additions and 12 deletions

View File

@@ -5218,6 +5218,7 @@ static char *handle_bridge_show_specific(struct ast_cli_entry *e, int cmd, struc
ast_cli(a->fd, "Subclass: %s\n", snapshot->subclass); ast_cli(a->fd, "Subclass: %s\n", snapshot->subclass);
ast_cli(a->fd, "Creator: %s\n", snapshot->creator); ast_cli(a->fd, "Creator: %s\n", snapshot->creator);
ast_cli(a->fd, "Name: %s\n", snapshot->name); ast_cli(a->fd, "Name: %s\n", snapshot->name);
ast_cli(a->fd, "Video-Mode: %s\n", ast_bridge_video_mode_to_string(snapshot->video_mode));
ast_cli(a->fd, "Video-Source-Id: %s\n", snapshot->video_source_id); ast_cli(a->fd, "Video-Source-Id: %s\n", snapshot->video_source_id);
ast_cli(a->fd, "Num-Channels: %u\n", snapshot->num_channels); ast_cli(a->fd, "Num-Channels: %u\n", snapshot->num_channels);
ast_cli(a->fd, "Num-Active: %u\n", snapshot->num_active); ast_cli(a->fd, "Num-Active: %u\n", snapshot->num_active);

View File

@@ -808,22 +808,14 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam
return NULL; return NULL;
} }
bridge = bridge_stasis_new(capabilities, flags, name, id); bridge = bridge_stasis_new(capabilities, flags, name, id, video_mode);
if (bridge) { if (bridge) {
if (video_mode == AST_BRIDGE_VIDEO_MODE_SFU) {
ast_bridge_set_sfu_video_mode(bridge);
/* We require a minimum 5 seconds between video updates to stop floods from clients,
* this should rarely be changed but should become configurable in the future.
*/
ast_bridge_set_video_update_discard(bridge, 5);
} else {
ast_bridge_set_talker_src_video_mode(bridge);
}
if (!ao2_link(app_bridges, bridge)) { if (!ao2_link(app_bridges, bridge)) {
ast_bridge_destroy(bridge, 0); ast_bridge_destroy(bridge, 0);
bridge = NULL; bridge = NULL;
} }
} }
return bridge; return bridge;
} }

View File

@@ -297,12 +297,26 @@ static void bridge_stasis_pull(struct ast_bridge *self, struct ast_bridge_channe
ast_bridge_base_v_table.pull(self, bridge_channel); ast_bridge_base_v_table.pull(self, bridge_channel);
} }
struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id) struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id, enum ast_bridge_video_mode_type video_mode)
{ {
void *bridge; void *bridge;
bridge = bridge_alloc(sizeof(struct ast_bridge), &bridge_stasis_v_table); bridge = bridge_alloc(sizeof(struct ast_bridge), &bridge_stasis_v_table);
bridge = bridge_base_init(bridge, capabilities, flags, "Stasis", name, id); bridge = bridge_base_init(bridge, capabilities, flags, "Stasis", name, id);
if (!bridge) {
return NULL;
}
if (video_mode == AST_BRIDGE_VIDEO_MODE_SFU) {
ast_bridge_set_sfu_video_mode(bridge);
/* We require a minimum 5 seconds between video updates to stop floods from clients,
* this should rarely be changed but should become configurable in the future.
*/
ast_bridge_set_video_update_discard(bridge, 5);
} else {
ast_bridge_set_talker_src_video_mode(bridge);
}
bridge = bridge_register(bridge); bridge = bridge_register(bridge);
return bridge; return bridge;

View File

@@ -50,11 +50,12 @@ extern "C" {
* \param flags Flags that will alter the behavior of the bridge * \param flags Flags that will alter the behavior of the bridge
* \param name Name given to the bridge by Stasis (optional) * \param name Name given to the bridge by Stasis (optional)
* \param id Unique ID given to the bridge by Stasis (optional) * \param id Unique ID given to the bridge by Stasis (optional)
* \param video_mode Video mode of the bridge
* *
* \retval a pointer to a new bridge on success * \retval a pointer to a new bridge on success
* \retval NULL on failure * \retval NULL on failure
*/ */
struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id); struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id, enum ast_bridge_video_mode_type video_mode);
/*! /*!
* \internal * \internal