Internet Streaming

Hi!
I have some problems with internet streaming. When I want to listen to some music(no matter what format), moc keeps "Connecting...", but he never get connected ;/ I have curl (7.16.2) and moc from svn.
I hope somebody will help me...

Does MOC hang completely? Can you play a local file when "Connecting..." is displayed? Please also provide a URL you use.

--
Damian Pietras - MOC developer

MOC doesn't hang. I can change song, 'stop' works too.
URLs:
http://207.200.96.229:8030 - mp3 stream
http://160.79.128.61:7018 - aac+ stream

PS: Mplayer can play these streams.
--edit--
I have the same problem with MOC 2.4.1

I've just tested it with libcurl 7.16.2 and have the same problem. libcurl 7.15.4 provided with my system works. I'll try to fix that.

--
Damian Pietras - MOC developer

I've just tried 2.5.0-alpha2 with curl 7.16.2 and no luck listening
to any stream.

regards,

dk

No, after searching curl mailing lists and google I don't know what's wrong.

--
Damian Pietras - MOC developer

it seems curl is not pharsing the stream properly...
Ive taken a trace from server log as below: (notice read buffer is 0, stream too short)
hope you can give us a fix for this soon, as im on debian/sid and I have to use libcurl4-gnutls (since i am using ooffice)

---------

Jun 24 13:40:10.45034: io_curl.c:319 curl_read_internal(): Starting curl...
Jun 24 13:40:10.50415: io_curl.c:169 debug_callback(): CURL: [INFO] About to connect() to radio.internode.on.net port 8050 (#0)
Jun 24 13:40:10.50530: io_curl.c:169 debug_callback(): CURL: [INFO] Trying 203.16.214.174...
Jun 24 13:40:10.50630: io_curl.c:341 curl_read_internal(): Doing select()...
Jun 24 13:40:10.73821: io_curl.c:169 debug_callback(): CURL: [INFO] Connected to radio.internode.on.net (203.16.214.174) port 8050 (#0)
Jun 24 13:40:10.73961: io_curl.c:169 debug_callback(): CURL: [SEND HEADER] GET /listen.pls HTTP/1.1
User-Agent: moc/2.5.0-alpha2
Host: radio.internode.on.net:8050
Accept: */*
Icy-MetaData: 1

Jun 24 13:40:10.74006: io_curl.c:341 curl_read_internal(): Doing select()...
Jun 24 13:40:10.115781: io_curl.c:169 debug_callback(): CURL: [RECV HEADER] HTTP/1.0 200 OK
Jun 24 13:40:10.115863: io_curl.c:169 debug_callback(): CURL: [RECV HEADER] content-type:audio/x-scpls
Jun 24 13:40:10.115891: io_curl.c:98 header_callback(): Mime type: 'audio/x-scpls'
Jun 24 13:40:10.115917: io_curl.c:169 debug_callback(): CURL: [RECV HEADER] Connection: close
Jun 24 13:40:10.115945: io_curl.c:169 debug_callback(): CURL: [RECV HEADER]
Jun 24 13:40:10.115972: io_curl.c:61 write_callback(): Got 71 bytes
Jun 24 13:40:10.116005: io_curl.c:579 io_curl_read(): Read 71 bytes from the buffer (71 bytes full)
Jun 24 13:40:10.116029: io_curl.c:341 curl_read_internal(): Doing select()...
Jun 24 13:40:10.116729: io_curl.c:169 debug_callback(): CURL: [INFO] Expire cleared
Jun 24 13:40:10.116772: io_curl.c:169 debug_callback(): CURL: [INFO] Closing connection #0
Jun 24 13:40:10.116836: io_curl.c:195 check_curl_stream(): EOF
Jun 24 13:40:10.116886: io_curl.c:579 io_curl_read(): Read 0 bytes from the buffer (0 bytes full)
Jun 24 13:40:10.116965: decoder.c:127 get_decoder_by_content(): Stream too short
Jun 24 13:40:10.116996: io.c:273 io_close(): Closing stream...
Jun 24 13:40:10.117020: io.c:257 io_abort(): Aborting...
Jun 24 13:40:10.117054: io.c:264 io_abort(): done

It seems You've entered URL to the playlist (listen.pls) not to the stream. You must download the playlist and open it locally in MOC.

--
Damian Pietras - MOC developer

Umm..i did that, but same story...

# cat /tmp/listen.pls
[playlist]
NumberOfEntries=1
File1=http://radio.internode.on.net:8078/

I used http://radio.internode.on.net:8078 as my url, but it still doesnt play. same error in log.
This works ok in xmms or anyother player.

I also did this:

# wget -O test.mp3 http://radio.internode.on.net:8078/
--02:28:43-- http://radio.internode.on.net:8078/
=> `test.mp3'
Resolving radio.internode.on.net... 203.16.214.174
Connecting to radio.internode.on.net|203.16.214.174|:8078... connected.
HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9
Length: unspecified

[ <=> ] 332,507 104.27K/s
^C
# head -20 test.mp3
ICY 200 OK
icy-notice1:
This stream requires Winamp

icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.7

icy-name:SALSASTREAM - Best Salsa Collection now on S K Y . F M!
icy-genre:Latin Salsa
icy-url:http://www.sky.fm
content-type:audio/mpeg
icy-pub:0
icy-br:192

æ<¿¤}×uúB«ßõíÉ¿þ]ßþà` Õ¼ËaìK¦± 66µ2U½
# vi test.mp3 (strip out the head stuff)

I can then play the test.mp3 using MOC, so it seems that the mp3 portion decodes ok in moc, but not via the url option

So this is the bug. I can't test it because I can't even connect to this URL, but there is no solution yet.

--
Damian Pietras - MOC developer

MOC doesnt work with any shoutcast urls
try this one for example:
http://222.122.131.29:2200

or you can download more listen.pls files and then try
http://www.winamp.com/media/radio

I know this, it affects some newer versions of curl. I tried to resolve this issue, but with no luck.

--
Damian Pietras - MOC developer

if this is curl related issue, i can try moc with an old curl version.
can you suggest which version of curl i should try?

I'm using 7.15.5 and have no problems. Remember that you probably need to recompile MOC with this version of curl and IT'S headers.

--
Damian Pietras - MOC developer

-see below

I found a bad select() without timeout in the code that makes assumptions it shouldn't. I recommend a fix in this style (I didn't test, only written to explain my point):

<br /> --- moc-2.4.4/io_curl.c 2007-07-08 08:54:45.000000000 +0200<br /> +++ moc-2.4.4-daniel/io_curl.c 2011-05-18 09:09:40.000000000 +0200<br /> @@ -338,6 +338,8 @@<br /> fd_set read_fds, write_fds, exc_fds;<br /> int max_fd;<br /> int ret;<br /> + long milliseconds;<br /> + struct timeval timeout;</p> <p> logit ("Doing select()...");</p> <p>@@ -356,8 +358,14 @@<br /> if (s-&gt;curl.wake_up_pipe[0] &gt; max_fd)<br /> max_fd = s-&gt;curl.wake_up_pipe[0];</p> <p>+ curl_multi_timeout(s-&gt;curl.multi_handle, &amp;milliseconds);<br /> + if(milliseconds &lt;= 0)<br /> + milliseconds = 1000; /* just a cautionary default */<br /> + timeout.tv_sec = milliseconds / 1000;<br /> + timeout.tv_usec = (milliseconds % 1000) * 1000;<br /> +<br /> ret = select (max_fd + 1, &amp;read_fds, &amp;write_fds,<br /> - &amp;exc_fds, NULL);<br /> + &amp;exc_fds, &amp;timeout);</p> <p> if (ret &lt; 0 &amp;&amp; errno == EINTR) {<br /> logit ("Interrupted");</p> <p>

This patch solves the problem for me!
Thank you!

Committed to SVN as r2319.

Probably also fixes or partially fixes: 762, 747 and 779.
Thank you "badger"; a good find.

This patch doesn't work for me. curl is 7.21.
Is this the correct command to start the stream player ? --> mocp http://207.200.96.229:8030/

moc-2.5.0-alpha4

Regards.

Hi! I want to listen from Internet radios in moc, the trouble is when my internet provider renews its conection. When renews the conection moc stops and I have to manually start the file again. Help!