<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6029">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Matthew Fredrickson: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_softmix: Use removed stream spots when renegotiating.<br><br>Streams are never truly removed in SDP, they still occupy<br>a location within the SDP. This location can be reused by<br>another stream if it so chooses.<br><br>This change takes advantage of this such that if a new stream<br>is needing to be added for a new participant any removed streams<br>are instead replaced first. This reduces the size of the SDP<br>and the number of streams.<br><br>ASTERISK-27134<br><br>Change-Id: I95cdcfd55cf47e02ea52abb5d94008db3fb68b1d<br>---<br>M bridges/bridge_softmix.c<br>1 file changed, 18 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c<br>index ae877eb..3801ccb 100644<br>--- a/bridges/bridge_softmix.c<br>+++ b/bridges/bridge_softmix.c<br>@@ -524,15 +524,32 @@<br>         const struct ast_stream_topology *source)<br> {<br>         int i;<br>+       int dest_index = 0;<br> <br>        for (i = 0; i < ast_stream_topology_get_count(source); ++i) {<br>              struct ast_stream *clone;<br>+            int added = 0;<br> <br>             clone = ast_stream_clone(ast_stream_topology_get_stream(source, i), NULL);<br>            if (!clone) {<br>                         return -1;<br>            }<br>-            if (ast_stream_topology_append_stream(dest, clone) < 0) {<br>+<br>+              /* If we can reuse an existing removed stream then do so */<br>+          while (dest_index < ast_stream_topology_get_count(dest)) {<br>+                        struct ast_stream *stream = ast_stream_topology_get_stream(dest, dest_index);<br>+<br>+                     dest_index++;<br>+<br>+                     if (ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED) {<br>+                              ast_stream_topology_set_stream(dest, dest_index - 1, clone);<br>+                         added = 1;<br>+                           break;<br>+                       }<br>+            }<br>+<br>+         /* If no removed stream exists that we took the place of append the stream */<br>+                if (!added && ast_stream_topology_append_stream(dest, clone) < 0) {<br>                        ast_stream_free(clone);<br>                       return -1;<br>            }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6029">change 6029</a>. To unsubscribe, 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/6029"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I95cdcfd55cf47e02ea52abb5d94008db3fb68b1d </div>
<div style="display:none"> Gerrit-Change-Number: 6029 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>