diff options
author | Joshua Colp <jcolp@digium.com> | 2017-09-28 10:33:00 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-09-28 10:33:00 +0000 |
commit | ce08a5b3f642a95fc7608e5690e44e103930dba0 (patch) | |
tree | a7bb2dc3a60dbe0d14f905ddf1b2ab2dac71f83d | |
parent | 4e4520854a3ac9862e1165c520154f729b157361 (diff) |
res_stasis: Add 'video_sfu' as a requested bridge type.
This change adds 'video_sfu' as a requested bridge type when
creating a bridge. By specifying this a mixing type bridge is
created that exchanges video in an SFU fashion.
Change-Id: I2ada47cf5f3fc176518b647c0b4aa39d55339606
-rw-r--r-- | res/res_stasis.c | 19 | ||||
-rw-r--r-- | rest-api/api-docs/bridges.json | 4 |
2 files changed, 20 insertions, 3 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c index 899c8f720..f99dcee37 100644 --- a/res/res_stasis.c +++ b/res/res_stasis.c @@ -766,6 +766,7 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam int flags = AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM | AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_SWAP_INHIBIT_TO | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY; + enum ast_bridge_video_mode_type video_mode = AST_BRIDGE_VIDEO_MODE_TALKER_SRC; if (invisible) { flags |= AST_BRIDGE_FLAG_INVISIBLE; @@ -782,9 +783,17 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam } else if (!strcmp(requested_type, "dtmf_events") || !strcmp(requested_type, "proxy_media")) { capabilities &= ~AST_BRIDGE_CAPABILITY_NATIVE; + } else if (!strcmp(requested_type, "video_sfu")) { + video_mode = AST_BRIDGE_VIDEO_MODE_SFU; } } + /* For an SFU video bridge we ensure it always remains in multimix for the best experience. */ + if (video_mode == AST_BRIDGE_VIDEO_MODE_SFU) { + capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX; + flags &= ~AST_BRIDGE_FLAG_SMART; + } + if (!capabilities /* Holding and mixing capabilities don't mix. */ || ((capabilities & AST_BRIDGE_CAPABILITY_HOLDING) @@ -794,7 +803,15 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam bridge = bridge_stasis_new(capabilities, flags, name, id); if (bridge) { - ast_bridge_set_talker_src_video_mode(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)) { ast_bridge_destroy(bridge, 0); bridge = NULL; diff --git a/rest-api/api-docs/bridges.json b/rest-api/api-docs/bridges.json index 03a1e7a69..877fdf84d 100644 --- a/rest-api/api-docs/bridges.json +++ b/rest-api/api-docs/bridges.json @@ -26,7 +26,7 @@ "parameters": [ { "name": "type", - "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media).", + "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu).", "paramType": "query", "required": false, "allowMultiple": false, @@ -65,7 +65,7 @@ "parameters": [ { "name": "type", - "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media) to set.", + "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu) to set.", "paramType": "query", "required": false, "allowMultiple": false, |