bryangrim / darkice

Automatically exported from code.google.com/p/darkice
0 stars 0 forks source link

Couple quick code fix suggestions... #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1st issue:
Not sure if this is specifically fedora packager related, but can't compile 
with jackd support due to "#include <limits.h>" missing from JackDspSource.cpp. 
 Add that in and jackd support compiles just fine.

2nd issue is with Shoutcast DNAS server 2, there is an issue with the icy-name 
header being split onto 2 "lines" when sending to the server.  Something DNAS 
v2 doesn't want to play well with.  This makes darkice unable to connect to a 
v2 shoutcast server with the server-side error... "connection rejected. Bad icy 
header string [icy-name:]".  BUTT also has this same issue with non-windows 
versions of their client.

From ShoutCast.cpp

    /* send the icy headers */
    if ( getName() ) {
        str = "icy-name:";
        sink->write( str, strlen( str));
        str = getName();
        sink->write( str, strlen( str));
    }

If I manually set str = "icy-name:Something" and remove the str=getName() and 
2nd sink->write call, then I can connect just fine to a v2 DNAS server, 
although the rest of the header info fails to apply to the stream.  At least I 
confirmed the problem and got it working.

So, I guess I'd suggest converting all the icy headers to one-liners... maybe 
something like...

    /* send the icy headers */
    if ( getName() ) {
        sprintf(str, "icy-name:%s", getName());
        sink->write( str, strlen( str));
    }

I saw on the shoutcast forums where an unreleased fix was being tested for DNAS 
v2 servers to take multi-line headers, but I guess the fix isn't out there yet, 
or was BUTT streaming tool specific.  That post was back in march or may though.

But looking at a packet capture it's really clear... you send one packet with 
"icy-name" and then then next packet contains the name and other header info.  
Not sure if all the headers need to be in one write, or if each needs their 
own... or what.  I can play with it more later, just wanted to get it reported 
now.

Original issue reported on code.google.com by alt.p...@gmail.com on 22 Oct 2012 at 6:05

GoogleCodeExporter commented 8 years ago
Here is a patch to send each icy header with a single write :
https://github.com/tryphon/darkice/compare/shoutcast2-icy-headers

Tested successfully this morning on a shoutcast 2.0.0.29.

Original comment by alban.pe...@gmail.com on 3 Apr 2013 at 7:02

GoogleCodeExporter commented 8 years ago
I've refactored the icy-headers code in r508. It should fixed this issue (like 
#76).

Original comment by alban.pe...@gmail.com on 18 May 2013 at 7:33