<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17810">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_mp3: Throw warning on nonexistent stream<br><br>Currently, the MP3Player application doesn't<br>emit a warning if attempting to play a stream<br>which no longer exists. This can be a common<br>scenario as many mp3 streams are valid at some<br>point but can disappear at any time.<br><br>Now a warning is thrown if attempting to play<br>a nonexistent MP3 stream, instead of silently<br>exiting.<br><br>ASTERISK-29829 #close<br><br>Change-Id: I53a0bf1ed1740166655eb66fe7675f6f808bf535<br>---<br>M apps/app_mp3.c<br>1 file changed, 5 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/17810/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 888f21a..5d2fc88 100644</span><br><span>--- a/apps/app_mp3.c</span><br><span>+++ b/apps/app_mp3.c</span><br><span>@@ -179,6 +179,7 @@</span><br><span>   int pid = -1;</span><br><span>        RAII_VAR(struct ast_format *, owriteformat, NULL, ao2_cleanup);</span><br><span>      int timeout = 2;</span><br><span style="color: hsl(120, 100%, 40%);">+      int startedmp3 = 0;</span><br><span>  struct timeval next;</span><br><span>         struct ast_frame *f;</span><br><span>         struct myframe {</span><br><span>@@ -242,12 +243,16 @@</span><br><span>                             if (res > 0) {</span><br><span>                                    myf.f.datalen = res;</span><br><span>                                         myf.f.samples = res / 2;</span><br><span style="color: hsl(120, 100%, 40%);">+                                      startedmp3 = 1;</span><br><span>                                      if (ast_write(chan, &myf.f) < 0) {</span><br><span>                                            res = -1;</span><br><span>                                            break;</span><br><span>                                       }</span><br><span>                            } else {</span><br><span>                                     ast_debug(1, "No more mp3\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                                      if (!startedmp3) { /* we couldn't do anything, which means this stream doesn't work */</span><br><span style="color: hsl(120, 100%, 40%);">+                                                ast_log(LOG_WARNING, "MP3 stream '%s' is broken or nonexistent\n", data);</span><br><span style="color: hsl(120, 100%, 40%);">+                                   }</span><br><span>                                    res = 0;</span><br><span>                                     break;</span><br><span>                               }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17810">change 17810</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/+/17810"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I53a0bf1ed1740166655eb66fe7675f6f808bf535 </div>
<div style="display:none"> Gerrit-Change-Number: 17810 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>