[Asterisk-code-review] stream: Make ast stream topology create from format cap() al... (asterisk[master])
Richard Mudgett
asteriskteam at digium.com
Thu Apr 27 17:53:32 CDT 2017
Richard Mudgett has uploaded a new change for review. ( 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(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/53/5553/1
diff --git a/include/asterisk/stream.h b/include/asterisk/stream.h
index 1becae2..89829eb 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 9d36dbf..a9f7eb0 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: newchange
Gerrit-Change-Id: Ie29760c49c25d7022ba2124698283181a0dd5d08
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list