[Asterisk-code-review] bridge softmix: Use MSID:LABEL metadata as the cloned stream... (asterisk[16.1])

Xiemin Chen asteriskteam at digium.com
Sun Dec 16 07:02:09 CST 2018


Xiemin Chen has uploaded this change for review. ( https://gerrit.asterisk.org/10818


Change subject: bridge_softmix: Use MSID:LABEL metadata as the cloned stream's appendix
......................................................................

bridge_softmix: Use MSID:LABEL metadata as the cloned stream's appendix

To avoid the stream name collide if there're more than one video track
in one client. If client has multi video tracks, the name of ast_stream
which represents each video track may be the same. Use the MSID:LABEL
here because it's identifiable.

ASTERISK-28196 #close
Reported-by: xiemchen

Change-Id: Ib62b2886e8d3a30e481d94616b0ceaeab68a870b
---
M bridges/bridge_softmix.c
M res/res_pjsip_sdp_rtp.c
2 files changed, 16 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/18/10818/1

diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c
index cf61340..f7b8a69 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -502,6 +502,7 @@
 	const struct ast_stream_topology *source)
 {
 	int i;
+	const char *stream_identify;
 
 	for (i = 0; i < ast_stream_topology_get_count(source); ++i) {
 		struct ast_stream *stream;
@@ -513,8 +514,13 @@
 			continue;
 		}
 
+		stream_identify = ast_stream_get_metadata(stream, "MSID:LABEL");
+		if (NULL == stream_identify) {
+			stream_identify = ast_stream_get_name(stream);
+		}
+
 		if (ast_asprintf(&stream_clone_name, "%s_%s_%s", SOFTBRIDGE_VIDEO_DEST_PREFIX,
-			channel_name, ast_stream_get_name(stream)) < 0) {
+			channel_name, stream_identify) < 0) {
 			return -1;
 		}
 
@@ -2186,6 +2192,7 @@
 
 		for (i = 0; i < ast_stream_topology_get_count(topology); ++i) {
 			struct ast_stream *stream = ast_stream_topology_get_stream(topology, i);
+			const char *stream_identify;
 
 			if (is_video_source(stream)) {
 				AST_VECTOR_APPEND(&media_types, AST_MEDIA_TYPE_VIDEO);
@@ -2202,7 +2209,12 @@
 				 */
 				ast_channel_unlock(participant->chan);
 				ast_bridge_channel_unlock(participant);
-				map_source_to_destinations(ast_stream_get_name(stream), ast_channel_name(participant->chan),
+
+				stream_identify = ast_stream_get_metadata(stream, "MSID:LABEL");
+				if (NULL == stream_identify) {
+					stream_identify = ast_stream_get_name(stream);
+				}
+				map_source_to_destinations(stream_identify, ast_channel_name(participant->chan),
 					AST_VECTOR_SIZE(&media_types) - 1, &bridge->channels);
 				ast_bridge_channel_lock(participant);
 				ast_channel_lock(participant->chan);
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 2889615..0145aa2 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1156,6 +1156,8 @@
 
 	if (ast_strlen_zero(session_media->label)) {
 			ast_uuid_generate_str(session_media->label, sizeof(session_media->label));
+			/* add for stream identification to replace stream_name */
+			ast_stream_set_metadata(stream, "MSID:LABEL", session_media->label);
 	}
 
 	snprintf(msid, sizeof(msid), "%s %s", session_media->mslabel, session_media->label);

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

Gerrit-Project: asterisk
Gerrit-Branch: 16.1
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib62b2886e8d3a30e481d94616b0ceaeab68a870b
Gerrit-Change-Number: 10818
Gerrit-PatchSet: 1
Gerrit-Owner: Xiemin Chen <chenxiemin at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181216/3dde92c6/attachment.html>


More information about the asterisk-code-review mailing list