Summary:ASTERISK-04334: [patch] fix app_mp3 to work with http urls
Reporter:deti (deti)Labels:
Date Opened:2005-06-03 10:49:59Date Closed:2011-06-07 14:10:03
Versions:Frequency of
Environment:Attachments:( 0) app_mp3.c.patch.txt
Description:since asterisk 1.0 app_mp3 does not work any longer with http urls. It seems that mpg123 is called incorrectly which causes interrupted sound. This patch fixes the problem by eliminating the extra code when using http:// filenames. It has been tested on 1.0.7 and CVS-HEAD and works properly on linux (kernel 2.4/2.6).


Disclaimer is on file.
Comments:By: deti (deti) 2005-06-03 10:58:18

The patch has been tested using the url http://stream.lrz-muenchen.de:31337/m945-hq.mp3

By: Kevin P. Fleming (kpfleming) 2005-06-03 15:29:26

The only thing your patch is doing is reverting the 1k buffer that's being used when an HTTP URL is in use. Why do you think it's being called "incorrectly"?

By: deti (deti) 2005-06-03 15:59:50

Currently it does not work on at least three different systems. Try it yourself and you'll see what I mean.

By: Kevin P. Fleming (kpfleming) 2005-06-03 17:18:31

Hmm... I can't get that stream to play properly in app_mp3 at all, but it works fine if used as music-on-hold on the same box. I've even tested mpg123 being invoked with the same arguments in both cases (and with the equivalent of your patch), and it never plays properly with app_mp3.

By: deti (deti) 2005-06-04 06:29:41

Make sure you are using mpg123 version 0.59r installable from asterisk repository.

By: Kevin P. Fleming (kpfleming) 2005-06-05 11:07:16

I am doing so, on a freshly built system. As I said, it works fine as music-on-hold on the same box, but not via app_mp3.

By: Kevin P. Fleming (kpfleming) 2005-08-22 16:55:03

Suspending this bug due to lack of interest from the original poster or any other users. If this problem persists and is reproducable, with a patch that fixes it, please reopen the bug with details on how to reproduce it.

By: Michael Kuron (mkuron) 2012-02-21 04:01:43.252-0600

The "-b 1024" causes mpg123 to buffer 1 megabyte (!) of the stream before outputting data. This can easily be observed by manually running mpg123 -q -z -s -b 1024 -f 8192 --mono -r 8000 -@ http://mp3-live.swr3.de/swr3_m.m3u on a command line: it takes about a minute (on a 128kbit stream) before data is printed out. If I reduce the buffer to "-b 8" (8 kilobyte), it only takes a second.
So yes, the app_mp3 code is calling mpg123 incorrectly because it assumes the buffer to be given in bytes instead of kilobytes.