<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14420">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge: Don't try to match audio formats.<br><br>When bridging channels we were trying to match the audio<br>formats of both sides in combination with the configured<br>formats. While this is allowed in SDP in practice this<br>causes extra reinvites and problems. This change ensures<br>that audio streams use the formats of the first existing<br>active audio stream. It is only when other stream types<br>(like video) exist that this will result in re-negotiation<br>occurring for those streams only.<br><br>ASTERISK-28871<br><br>Change-Id: I22f5a3e7db29e00c165e74d05d10856f6086fe47<br>---<br>M bridges/bridge_native_rtp.c<br>M bridges/bridge_simple.c<br>2 files changed, 4 insertions(+), 24 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/20/14420/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c</span><br><span>index 19c6ab5..efe476e 100644</span><br><span>--- a/bridges/bridge_native_rtp.c</span><br><span>+++ b/bridges/bridge_native_rtp.c</span><br><span>@@ -886,8 +886,6 @@</span><br><span> </span><br><span> if (audio_formats) {</span><br><span> for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_format_cap *joint;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> stream = ast_stream_topology_get_stream(new_topology, i);</span><br><span> </span><br><span> if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||</span><br><span>@@ -895,16 +893,8 @@</span><br><span> continue;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- joint = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!joint) {</span><br><span style="color: hsl(0, 100%, 40%);">- continue;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_cap_append_from_cap(joint, ast_stream_get_formats(stream),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_MEDIA_TYPE_AUDIO);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_cap_append_from_cap(joint, audio_formats, AST_MEDIA_TYPE_AUDIO);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stream_set_formats(stream, joint);</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(joint, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We haven't actually modified audio_formats so this is safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);</span><br><span> }</span><br><span> }</span><br><span> </span><br><span>diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c</span><br><span>index abda774..1e224f7 100644</span><br><span>--- a/bridges/bridge_simple.c</span><br><span>+++ b/bridges/bridge_simple.c</span><br><span>@@ -90,8 +90,6 @@</span><br><span> </span><br><span> if (audio_formats) {</span><br><span> for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_format_cap *joint;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> stream = ast_stream_topology_get_stream(new_topology, i);</span><br><span> </span><br><span> if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||</span><br><span>@@ -99,16 +97,8 @@</span><br><span> continue;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- joint = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!joint) {</span><br><span style="color: hsl(0, 100%, 40%);">- continue;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_cap_append_from_cap(joint, ast_stream_get_formats(stream),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_MEDIA_TYPE_AUDIO);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_cap_append_from_cap(joint, audio_formats, AST_MEDIA_TYPE_AUDIO);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stream_set_formats(stream, joint);</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(joint, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We haven't actually modified audio_formats so this is safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);</span><br><span> }</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14420">change 14420</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14420"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I22f5a3e7db29e00c165e74d05d10856f6086fe47 </div>
<div style="display:none"> Gerrit-Change-Number: 14420 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>