if (audio_formats) {
for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) {
- struct ast_format_cap *joint;
-
stream = ast_stream_topology_get_stream(new_topology, i);
if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||
continue;
}
- joint = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
- if (!joint) {
- continue;
- }
-
- ast_format_cap_append_from_cap(joint, ast_stream_get_formats(stream),
- AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_append_from_cap(joint, audio_formats, AST_MEDIA_TYPE_AUDIO);
- ast_stream_set_formats(stream, joint);
- ao2_ref(joint, -1);
+ /* We haven't actually modified audio_formats so this is safe */
+ ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);
}
}
if (audio_formats) {
for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) {
- struct ast_format_cap *joint;
-
stream = ast_stream_topology_get_stream(new_topology, i);
if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||
continue;
}
- joint = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
- if (!joint) {
- continue;
- }
-
- ast_format_cap_append_from_cap(joint, ast_stream_get_formats(stream),
- AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_append_from_cap(joint, audio_formats, AST_MEDIA_TYPE_AUDIO);
- ast_stream_set_formats(stream, joint);
- ao2_ref(joint, -1);
+ /* We haven't actually modified audio_formats so this is safe */
+ ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);
}
}