[icecast-dev] Fwd: Patch to icecast2

Ricardo Galli gallir at uib.es
Thu Jan 16 19:48:39 PST 2003

Hash: SHA1

Hi Mike,
        I think you dealing with the development. 

Almost a year ago I've sent few patches to Jack, several of them are 
already applied to the current version.

I'm back again, and tested the last version. I noticed it isn't as 
resilient to network congestion as my last patched version (just 
disconnect the ethernet cable of the adsl router for a couple de seconds 
and the connection is lost). My last version (which is at least 11 months 
old) is working very nice at http://www.onamallorca.net:8000/ona.ogg 
(with a very old vorbis lib, I think it's rc2). 

So, if you are interested, I could try to update the changes to the last 
version. Find enclosed the _first_ patch I've sent to jack, some of the 
items are already applied (for example #3) but the rest are "pending".

I'm very interesting in porting them if you din't find any big (or 
"conceptual") mistake.

I also like the "prebuffering" feature (which is called "faststart", at 
least by Apple), but Jack was not convinced to include it. What do you 


PS: I can forward to you the remainng 3 patches I've sent last year if you 
want to take a look, they are less intrusive than this, and some parts 
are already included (I am checking the code, line by line... too many 
changes in one year :-)

<p>- -- 
  ricardo galli       GPG id C8114D34
Version: GnuPG v1.2.1 (GNU/Linux)


<strong>attached mail follows:</strong><hr noshade>

Dear Jack,
        find attached a patch that improves a lot the performance and reliability in 
the server. Specifically, I started the modifications due to the 
unreliability of the connection (mainly due to the lack of control in the 
nonblocking socket) when the client pipe was saturated, even for few seconds, 
for exaple due to a web page download.

The problems tackled by this patch are:

1. The server didn't check for the status of the client's socket before the 
unblocking send(). This caused a disconnection at the minimum delay in the 
network. I've added a poll in sock.c

2. Many vorbis players do a very bad job in prebuffering (notably freeamp), 
so we are forcing a kind of prebufering now. The server keeps the last 
seconds of each source, when a new client connects, we send these previous 
buffers as fast as the network allows (this is checked by -1-). To allow the 
control by seconds instead of time, I added a timestamp to refbuf (which 
could be also used by checking the client queue length by seconds).

3. Solved a bug in source.c, when checking for recoverable error. It has to 
be done _only_ when result < 0.

4. Created a new function (send_client_queue) to send the client->queue. 
Better modularisation.

5. When a new client is added, we send the metadata right after adding it to 
the queue (I use the previous function). This improve a lot startup time 
inthe client.

6. Moved queue_lenght verification to the send_client_queue(). It doesn't 
make sense to do it if there is no pending buffers.

7. Added TCP_NODELAY to a nonblocking socket. It is said that it's improve 
performance in Linux. TODO: check Win32 compatibility.

You can try my version in http://mcrg.uib.es:8000/live.ogg (if the server is 
down, please wait few seconds and try again, I am restarting it frequently 
for my tests).

Conclusions: _very_ stable connection, it recovers from network congestion 
very nicely.

Don't hesitate to ask me for changes or improvements to my patch.


  ricardo galli
  gallir at uib.es
"I just stopped using Windows and now you tell me to use Mirrors?" 
    - said Aunt Tillie, just before downloading 2.5.3 kernel.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch1.diff
Type: text/x-diff
Size: 12896 bytes
Desc: patch1.diff
Url : http://lists.xiph.org/pipermail/icecast-dev/attachments/20030117/00e3ce79/patch1.bin

More information about the Icecast-dev mailing list