stream: Create matching joint topology

When creating joint topologies, resolved topologies have to have equal
stream counts. Currently this only happens if first of the two given
topologies has equal or more streams.
This change adds remaining streams of second topology to the joint
topology.
This commit is contained in:
Bastian Triller 2023-09-22 10:41:23 +02:00
parent 671eeeca24
commit 42c0599b27
No known key found for this signature in database
GPG Key ID: 25062E7C0C91DA47
1 changed files with 19 additions and 0 deletions

View File

@ -1071,6 +1071,25 @@ struct ast_stream_topology *ast_stream_topology_create_resolved(
}
}
for (; i < AST_VECTOR_SIZE(&configured_topology->streams); i++) {
struct ast_stream *configured_stream = AST_VECTOR_GET(&configured_topology->streams, i);
struct ast_stream *joint_stream;
joint_stream = ast_stream_clone(configured_stream, NULL);
if (!joint_stream) {
ao2_cleanup(joint_topology);
return NULL;
}
ast_stream_set_state(joint_stream, AST_STREAM_STATE_REMOVED);
res = ast_stream_topology_append_stream(joint_topology, joint_stream);
if (res < 0) {
ast_stream_free(joint_stream);
ao2_cleanup(joint_topology);
return NULL;
}
}
return joint_topology;
}