[Asterisk-code-review] res_stasis.c: Added video_single option for bridge creation (asterisk[master])

sungtae kim asteriskteam at digium.com
Sun Aug 30 15:45:11 CDT 2020


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14882 )


Change subject: res_stasis.c: Added video_single option for bridge creation
......................................................................

res_stasis.c: Added video_single option for bridge creation

Currently, it was not possible to create bridge with video_mode single.
This made hard to put the bridge in a vidoe_single mode.
So, added video_single option for Bridge creation using the ARI.
This allows create a bridge with video_mode single.

Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae
---
M main/bridge.c
M res/res_stasis.c
M res/stasis/stasis_bridge.c
M rest-api/api-docs/bridges.json
4 files changed, 15 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/82/14882/1

diff --git a/main/bridge.c b/main/bridge.c
index add586c..4a8075f 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -3809,13 +3809,15 @@
 	ast_bridge_lock(bridge);
 	cleanup_video_mode(bridge);
 	bridge->softmix.video_mode.mode = AST_BRIDGE_VIDEO_MODE_SINGLE_SRC;
-	bridge->softmix.video_mode.mode_data.single_src_data.chan_vsrc = ast_channel_ref(video_src_chan);
-	ast_verb(5, "Video source in bridge '%s' (%s) is now '%s' (%s)\n",
-		bridge->name, bridge->uniqueid,
-		ast_channel_name(video_src_chan),
-		ast_channel_uniqueid(video_src_chan));
+	if (video_src_chan) {
+		bridge->softmix.video_mode.mode_data.single_src_data.chan_vsrc = ast_channel_ref(video_src_chan);
+		ast_verb(5, "Video source in bridge '%s' (%s) is now '%s' (%s)\n",
+			bridge->name, bridge->uniqueid,
+			ast_channel_name(video_src_chan),
+			ast_channel_uniqueid(video_src_chan));
+		ast_indicate(video_src_chan, AST_CONTROL_VIDUPDATE);
+	}
 	ast_bridge_publish_state(bridge);
-	ast_indicate(video_src_chan, AST_CONTROL_VIDUPDATE);
 	ast_bridge_unlock(bridge);
 }
 
diff --git a/res/res_stasis.c b/res/res_stasis.c
index f975386..7d05e8b 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -792,6 +792,8 @@
 			capabilities &= ~AST_BRIDGE_CAPABILITY_NATIVE;
 		} else if (!strcmp(requested_type, "video_sfu")) {
 			video_mode = AST_BRIDGE_VIDEO_MODE_SFU;
+		} else if (!strcmp(requested_type, "video_single")) {
+			video_mode = AST_BRIDGE_VIDEO_MODE_SINGLE_SRC;
 		}
 	}
 
diff --git a/res/stasis/stasis_bridge.c b/res/stasis/stasis_bridge.c
index d5f70a0..fdfd8fb 100644
--- a/res/stasis/stasis_bridge.c
+++ b/res/stasis/stasis_bridge.c
@@ -313,6 +313,8 @@
 		 * this should rarely be changed but should become configurable in the future.
 		 */
 		ast_bridge_set_video_update_discard(bridge, 5);
+	} else if (video_mode == AST_BRIDGE_VIDEO_MODE_SINGLE_SRC) {
+		ast_bridge_set_single_src_video_mode(bridge, NULL);
 	} else {
 		ast_bridge_set_talker_src_video_mode(bridge);
 	}
diff --git a/rest-api/api-docs/bridges.json b/rest-api/api-docs/bridges.json
index a465137..bf0a001 100644
--- a/rest-api/api-docs/bridges.json
+++ b/rest-api/api-docs/bridges.json
@@ -30,7 +30,7 @@
 					"parameters": [
 						{
 							"name": "type",
-							"description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu).",
+							"description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single).",
 							"paramType": "query",
 							"required": false,
 							"allowMultiple": false,
@@ -69,7 +69,7 @@
 					"parameters": [
 						{
 							"name": "type",
-							"description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu) to set.",
+							"description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single) to set.",
 							"paramType": "query",
 							"required": false,
 							"allowMultiple": false,
@@ -755,7 +755,7 @@
 				},
 				"video_mode": {
 					"type": "string",
-					"description": "The video mode the bridge is using. One of 'none', 'talker', or 'single'.",
+					"description": "The video mode the bridge is using. One of 'none', 'talker', 'sfu', or 'single'.",
 					"required": false
 				},
 				"video_source_id": {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14882
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae
Gerrit-Change-Number: 14882
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200830/dbf5b217/attachment.html>


More information about the asterisk-code-review mailing list