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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">translate: Transcode siren14, speex32, silk24, and silk12 via slin16.<br><br>When a format has no pre-recorded sound files, Asterisk has to transcode between<br>formats. For this, Asterisk has a fixed translation table. If the pre-recorded<br>sound files are not available in the same sample rate, Asterisk has not only to<br>transcode but also to resample.<br><br>Asterisk has pre-recorded files for SLN (8000 kHz) and SLN16 (16000 kHz).<br>However before this change, Asterisk did not take the sample rate into account,<br>because the translation paths to SLN and SLN16 got the same score/weight in the<br>table. Consequently, you might have got narrow-band audio with siren14, speex32,<br>silk24, and silk12 although those are (ultra) wide-band audio codecs.<br><br>With this change, the distance in sample-rates is taken into account. Now on the<br>Command-Line interface (CLI) 'core show channels', you should see:<br>(slin@16000)->(slin@32000)->(speex@32000).<br><br>ASTERISK-23735<br>Reported by: Richard Kenner<br><br>Change-Id: I9448295c1978be26f8633b6066395e7bbbe2e213<br>---<br>M main/translate.c<br>1 file changed, 15 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/translate.c b/main/translate.c<br>index f2aa588..92c0cb9 100644<br>--- a/main/translate.c<br>+++ b/main/translate.c<br>@@ -32,6 +32,7 @@<br> #include <sys/time.h><br> #include <sys/resource.h><br> #include <math.h><br>+#include <stdlib.h><br> <br> #include "asterisk/lock.h"<br> #include "asterisk/channel.h"<br>@@ -1390,6 +1391,20 @@<br>                           ao2_replace(bestdst, dst);<br>                            besttablecost = matrix_get(x, y)->table_cost;<br>                              beststeps = matrix_get(x, y)->multistep;<br>+                  } else if (matrix_get(x, y)->table_cost == besttablecost<br>+                                  && matrix_get(x, y)->multistep == beststeps) {<br>+                            int gap_selected = abs(ast_format_get_sample_rate(best)<br>+                                      - ast_format_get_sample_rate(bestdst));<br>+                              int gap_current = abs(ast_format_get_sample_rate(src)<br>+                                        - ast_format_get_sample_rate(dst));<br>+<br>+                               if (gap_current < gap_selected) {<br>+                                 /* better than what we have so far */<br>+                                        ao2_replace(best, src);<br>+                                      ao2_replace(bestdst, dst);<br>+                                   besttablecost = matrix_get(x, y)->table_cost;<br>+                                     beststeps = matrix_get(x, y)->multistep;<br>+                          }<br>                     }<br>             }<br>     }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7372">change 7372</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/7372"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I9448295c1978be26f8633b6066395e7bbbe2e213 </div>
<div style="display:none"> Gerrit-Change-Number: 7372 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.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: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>