[icecast] buffer size from source to ice/shoutcast

Scott Manley djsnm at djsnm.com
Sat Nov 16 00:26:01 UTC 2002



Brandon wrote:

> Hello,
>  
> I've built my own source for ICE/SHOUTcast, and it works pretty well 
> except for one thing. After tuning into the server and listening for 
> an 60-90 minutes you may hear a song skip ahead 30-90 seconds. I think 
> I know why this is happening but I'mnot sure how to fix it.
>  
> I think this is happening because my source is sending a little bit 
> too much data to ICE/SHOUTcast. My formula for sending data is pretty 
> simple and goes like this:
>  
> buffersize = bitrate * 1024 / 8
> send buffer
> wait 1 second
> repeat
>  
> So..broadcasting at 128kbs means I send a buffer of 16384 bytes per 
> second.
>  

Well you have to realise the kilobit definition used with mp3 is 1kbit = 
1000bits/sec (Microsoft uses 1kbit=1024bits for it's media formats 
incidently).

But your algorithm will suffer because sending the data will take a 
non-negligible time -
better algorithm is

tart = time();
sent = 0;
while(1){
      sent += send_chunk();
      delta = time() - start;
      my_bitrate = sent *8 / delta;
       if(my_bitrate> target_bitrate){
            sleep(1); /* (or any short time)*/
       }
}

you maybe want to reset the sent/start parameters periodicly.

Scott Manley

--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Icecast mailing list