<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8835">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_softmix: Fix some REMB bugs.<br><br>This change fixes a bug where a REMB collector may be<br>freed twice, and also tweaks REMB combining such that if<br>there is no bitrate from anyone (or there are no sources)<br>we report 0 instead of using an old bitrate.<br><br>ASTERISK-27804<br><br>Change-Id: Ia9dc9c150043890ee7ff85e9cdec007f1a77fcfd<br>---<br>M bridges/bridge_softmix.c<br>1 file changed, 17 insertions(+), 12 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/35/8835/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 f0a3fb4..9423e91 100644<br>--- a/bridges/bridge_softmix.c<br>+++ b/bridges/bridge_softmix.c<br>@@ -1318,6 +1318,12 @@<br>                         break;<br>                }<br>     }<br>+<br>+ /* After the report is integrated we reset this to 0 in case they stop producing<br>+      * REMB reports.<br>+      */<br>+  sc->remb.br_mantissa = 0;<br>+ sc->remb.br_exp = 0;<br> }<br> <br> static void remb_send_report(struct ast_bridge_channel *bridge_channel, struct softmix_channel *sc)<br>@@ -1328,20 +1334,18 @@<br>                 return;<br>       }<br> <br>- /* If we have a new bitrate then use it for the REMB, if not we use the previous<br>-      * one until we know otherwise. This way the bitrate doesn't drop to 0 all of a sudden.<br>+  /* We always do this calculation as even when the bitrate is zero the browser<br>+         * still prefers it be accurate instead of lying.<br>      */<br>-  if (sc->remb_collector->bitrate) {<br>-             sc->remb_collector->feedback.remb.br_mantissa = sc->remb_collector->bitrate;<br>-             sc->remb_collector->feedback.remb.br_exp = 0;<br>+  sc->remb_collector->feedback.remb.br_mantissa = sc->remb_collector->bitrate;<br>+     sc->remb_collector->feedback.remb.br_exp = 0;<br> <br>-               /* The mantissa only has 18 bits available, so while it exceeds them we bump<br>-          * up the exp.<br>-                */<br>-          while (sc->remb_collector->feedback.remb.br_mantissa > 0x3ffff) {<br>-                   sc->remb_collector->feedback.remb.br_mantissa = sc->remb_collector->feedback.remb.br_mantissa >> 1;<br>-                        sc->remb_collector->feedback.remb.br_exp++;<br>-            }<br>+    /* The mantissa only has 18 bits available, so while it exceeds them we bump<br>+  * up the exp.<br>+        */<br>+  while (sc->remb_collector->feedback.remb.br_mantissa > 0x3ffff) {<br>+           sc->remb_collector->feedback.remb.br_mantissa = sc->remb_collector->feedback.remb.br_mantissa >> 1;<br>+                sc->remb_collector->feedback.remb.br_exp++;<br>     }<br> <br>  for (i = 0; i < AST_VECTOR_SIZE(&bridge_channel->stream_map.to_bridge); ++i) {<br>@@ -2081,6 +2085,7 @@<br>        * collector and won't need to allocate a new one (unless they were just added).<br>   */<br>   AST_VECTOR_RESET(&softmix_data->remb_collectors, ao2_cleanup);<br>+        AST_VECTOR_DEFAULT(&softmix_data->remb_collectors, AST_VECTOR_MAX_SIZE(&softmix_data->remb_collectors), NULL);<br> <br>       /* First traversal: re-initialize all of the participants' stream maps */<br>         AST_LIST_TRAVERSE(&bridge->channels, participant, entry) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8835">change 8835</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/8835"/><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: Ia9dc9c150043890ee7ff85e9cdec007f1a77fcfd </div>
<div style="display:none"> Gerrit-Change-Number: 8835 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>