<p>Carlos Oliva has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16501">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_mp3: Force output to 16 bits in mpg123<br><br>In new mpg123 versions (since 1.26) the default output is 32 bits<br>Asterisk expects the output in 16 bits, so we force the output to be on 16 bits.<br>It will work wit new and old versions of mpg123.<br>Thanks Thomas Orgis <thomas-forum@orgis.org> for giving the key!<br><br>ASTERISK-29635 #close<br><br>Change-Id: I88c7740118b5af4e895bd8b765b68ed5c11fc816<br>---<br>M apps/app_mp3.c<br>1 file changed, 12 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/01/16501/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_mp3.c b/apps/app_mp3.c</span><br><span>index 8d049da..8422240 100644</span><br><span>--- a/apps/app_mp3.c</span><br><span>+++ b/apps/app_mp3.c</span><br><span>@@ -100,37 +100,37 @@</span><br><span> char buffer_size_str[8];</span><br><span> snprintf(buffer_size_str, 8, "%u", (int) 0.5*2*sampling_rate/1000); // 0.5 seconds for a live stream</span><br><span> /* Most commonly installed in /usr/local/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(LOCAL_MPG_123, "mpg123", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(LOCAL_MPG_123, "mpg123", "-e", "s16", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span> /* But many places has it in /usr/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(MPG_123, "mpg123", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(MPG_123, "mpg123", "-e", "s16", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span> /* As a last-ditch effort, try to use PATH */</span><br><span style="color: hsl(0, 100%, 40%);">- execlp("mpg123", "mpg123", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execlp("mpg123", "mpg123", "-e", "s16", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span> }</span><br><span> else if (!strncasecmp(filename, "http://", 7)) {</span><br><span> char buffer_size_str[8];</span><br><span> snprintf(buffer_size_str, 8, "%u", 6*2*sampling_rate/1000); // 6 seconds for a remote MP3 file</span><br><span> /* Most commonly installed in /usr/local/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(LOCAL_MPG_123, "mpg123", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(LOCAL_MPG_123, "mpg123", "-e", "s16", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span> /* But many places has it in /usr/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(MPG_123, "mpg123", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(MPG_123, "mpg123", "-e", "s16", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span> /* As a last-ditch effort, try to use PATH */</span><br><span style="color: hsl(0, 100%, 40%);">- execlp("mpg123", "mpg123", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execlp("mpg123", "mpg123", "-e", "s16", "-q", "-s", "-b", buffer_size_str, "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span> }</span><br><span> else if (strstr(filename, ".m3u")) {</span><br><span> /* Most commonly installed in /usr/local/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(LOCAL_MPG_123, "mpg123", "-q", "-z", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(LOCAL_MPG_123, "mpg123", "-e", "s16", "-q", "-z", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span> /* But many places has it in /usr/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(MPG_123, "mpg123", "-q", "-z", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(MPG_123, "mpg123", "-e", "s16", "-q", "-z", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span> /* As a last-ditch effort, try to use PATH */</span><br><span style="color: hsl(0, 100%, 40%);">- execlp("mpg123", "mpg123", "-q", "-z", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execlp("mpg123", "mpg123", "-e", "s16", "-q", "-z", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, "-@", filename, (char *)NULL);</span><br><span> }</span><br><span> else {</span><br><span> /* Most commonly installed in /usr/local/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(MPG_123, "mpg123", "-q", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(MPG_123, "mpg123", "-e", "s16", "-q", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span> /* But many places has it in /usr/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(LOCAL_MPG_123, "mpg123", "-q", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execl(LOCAL_MPG_123, "mpg123", "-e", "s16", "-q", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span> /* As a last-ditch effort, try to use PATH */</span><br><span style="color: hsl(0, 100%, 40%);">- execlp("mpg123", "mpg123", "-q", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ execlp("mpg123", "mpg123", "-e", "s16", "-q", "-s", "-f", "8192", "--mono", "-r", sampling_rate_str, filename, (char *)NULL);</span><br><span> }</span><br><span> /* Can't use ast_log since FD's are closed */</span><br><span> fprintf(stderr, "Execute of mpg123 failed\n");</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16501">change 16501</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/+/16501"/><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: I88c7740118b5af4e895bd8b765b68ed5c11fc816 </div>
<div style="display:none"> Gerrit-Change-Number: 16501 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Carlos Oliva <carlos.oliva@invoxcontact.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>