<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6029">View Change</a></p><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;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/29/6029/1</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: newchange </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>