diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c index 19c6ab525b..efe476ecb2 100644 --- a/bridges/bridge_native_rtp.c +++ b/bridges/bridge_native_rtp.c @@ -886,8 +886,6 @@ static struct ast_stream_topology *native_rtp_request_stream_topology_update( 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 || @@ -895,16 +893,8 @@ static struct ast_stream_topology *native_rtp_request_stream_topology_update( 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); } } diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c index abda774dd5..1e224f782b 100644 --- a/bridges/bridge_simple.c +++ b/bridges/bridge_simple.c @@ -90,8 +90,6 @@ static struct ast_stream_topology *simple_bridge_request_stream_topology_update( 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 || @@ -99,16 +97,8 @@ static struct ast_stream_topology *simple_bridge_request_stream_topology_update( 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); } }