[icecast] streaming silence to Winamp

Michael Smith msmith at xiph.org
Tue Aug 5 01:06:08 UTC 2003



On Tuesday 05 August 2003 05:56, James Ponder wrote:
> Hi,
>
> I have just integrated libshout2 and libvorbisenc into mserv, my music
> server (www.mserv.org).
>
> It all works well.  Thanks for a great product.
>
> The problem I have is that when there is a pause between songs of around 10
> seconds, Winamp (2.91) decides (due to the 64kbps dropping to a 2kbps
> stream I guess), that it needs to re-buffer.  It fails miserably and
> generally dumps the connection, or at the very least a 10 second pause
> turns in to a 20 second pause (10 seconds re-buffering and then the 10
> second pause I wanted in the first place).
>
> I'm not sure where the problem lies exactly, but I suspect it's just
> Winamp's poor re-buffer algorithm.

Not really - it's not a winamp-specific problem, most of the audio players do 
it the same way, and it's not entirely unreasonable.

>
> This sounds like a problem that may have been solved before - how do I
> ensure that for long periods (minutes) that both Icecast and Winamp are
> happy?
>
>
> Best wishes, James

The problem is, as you've guessed, that the bitrate drops to something very 
low (probably actually less than 2 kbps), but this causes problems given the 
way libogg by default frames vorbis encoded data. Ogg pages are generally 
generated at about 4 kB in size - at 2 kbps, this is 16 seconds of audio. 

This means that _no_ data is sent at all for ~16 seconds. So, the trick is to 
flush the ogg stream (forcing a shorter-than-normal page to be created) if 
the bitrate has dropped too low. ices2 does this by forcing a new page if the 
current page contains more than ~2 seconds of audio (or some number - I think 
it's 2 seconds).

To do this, you should (conditionally, based on current page length) call 
ogg_stream_flush() instead of ogg_stream_pageout() - see ices/src/encode.c, 
around line 220, for an example of doing this (ices2 does not currently 
_accurately_ calculate the current page length, it uses an approximation 
which could sometimes be a fair way off - I should change this).

Mike

<p><p><p>--- >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