[Vorbis] ov_read, callbacks and 0 bytes read

Andrew Lentvorski bsder at allcaps.org
Thu Oct 5 21:01:48 PDT 2006


How does one deal with the case when an fread callback doesn't have any 
more data but is going to get more data in the future?

In particular, this is an issue when reading an incoming Ogg stream from 
  a socket (icecast2, in this case).

The issue is that the fread can't return 0 (that signals EOF and hoses 
everything), and it doesn't have a negative code that says come back 
later when you have more data.

I can't allow this to block as the system I am using does not have 
threads (embedded system).

A good example of this is to put too much information in the 
info/comment field that overflows the initial decode.  If ov_read can't 
get enough data to completely decode a packet, things go badly wrong.

What do other people do for handling streaming like this?

-a


More information about the Vorbis mailing list