summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-05-02 05:19:12 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-05-02 05:19:12 -0500
commit090c6b702ee7b92a48d9bdc1dad46526fca1403f (patch)
tree6d88824de91257a190d62b7cfd7608404f0e2f5b /main
parent9af53d3563047f9849cdaf3883a6b00340242236 (diff)
parent5c1851cbc0e31cc1fee108983b1937212002860c (diff)
Merge "stream: Make ast_stream_topology_create_from_format_cap() allow NULL cap."
Diffstat (limited to 'main')
-rw-r--r--main/channel_internal_api.c8
-rw-r--r--main/stream.c6
2 files changed, 4 insertions, 10 deletions
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index d838ea80c..7f32b2196 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -852,14 +852,10 @@ void ast_channel_nativeformats_set(struct ast_channel *chan,
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 cf2633e1b..39b6b1b13 100644
--- a/main/stream.c
+++ b/main/stream.c
@@ -345,11 +345,9 @@ struct ast_stream_topology *ast_stream_topology_create_from_format_cap(
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++) {