[asterisk-commits] stream: Make ast stream topology create from format cap() al... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 2 05:19:13 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5553 )

Change subject: stream: Make ast_stream_topology_create_from_format_cap() allow NULL cap.
......................................................................


stream: Make ast_stream_topology_create_from_format_cap() allow NULL cap.

Change-Id: Ie29760c49c25d7022ba2124698283181a0dd5d08
---
M include/asterisk/stream.h
M main/channel_internal_api.c
M main/stream.c
3 files changed, 5 insertions(+), 11 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Jenkins2: Approved for Submit
  Joshua Colp: Looks good to me, approved



diff --git a/include/asterisk/stream.h b/include/asterisk/stream.h
index 924bfb6..1e07407 100644
--- a/include/asterisk/stream.h
+++ b/include/asterisk/stream.h
@@ -356,7 +356,7 @@
  * creates a topology and separates the media types in format_cap into
  * separate streams.
  *
- * \param caps The format capabilities structure
+ * \param caps The format capabilities structure (NULL creates an empty topology)
  *
  * \retval non-NULL success
  * \retval NULL failure
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index d838ea8..7f32b21 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -852,14 +852,10 @@
 		return;
 	}
 
-	if ((!ast_channel_is_multistream(chan)) || !value) {
+	if (!ast_channel_is_multistream(chan) || !value) {
 		struct ast_stream_topology *new_topology;
 
-		if (!value) {
-			new_topology = ast_stream_topology_alloc();
-		} else {
-			new_topology = ast_stream_topology_create_from_format_cap(value);
-		}
+		new_topology = ast_stream_topology_create_from_format_cap(value);
 		ast_channel_internal_set_stream_topology(chan, new_topology);
 	}
 }
diff --git a/main/stream.c b/main/stream.c
index cf2633e..39b6b1b 100644
--- a/main/stream.c
+++ b/main/stream.c
@@ -345,11 +345,9 @@
 	struct ast_stream_topology *topology;
 	enum ast_media_type type;
 
-	ast_assert(cap != NULL);
-
 	topology = ast_stream_topology_alloc();
-	if (!topology) {
-		return NULL;
+	if (!topology || !cap || !ast_format_cap_count(cap)) {
+		return topology;
 	}
 
 	for (type = AST_MEDIA_TYPE_UNKNOWN + 1; type < AST_MEDIA_TYPE_END; type++) {

-- 
To view, visit https://gerrit.asterisk.org/5553
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie29760c49c25d7022ba2124698283181a0dd5d08
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list