[Theora] Stream Test

Ralph Giles giles at xiph.org
Thu Apr 6 12:43:26 PDT 2006

On Thu, Apr 06, 2006 at 08:21:04PM +0100, Robert Smith wrote:

> Any suggestions as to what can cause this? I am starting to wonder if its 
> actually oggz-validate that isnt handle 2 streams in an ogg file properly 
> as I am using the standard libogg and libvorbis libraries, as well as 
> theora-mmx.

The problem is in the order you write out the pages. They have to be 
sorted in strictly non-decreasing order by the time-equivalent of
their granulepos field. This is important for efficient seeking, and as
a side effect does a reasonable job minimizing buffer requirements
on the player side. The following algorithm should work:

Maintain a queue of pages for each substream. If all queues are full, 
write out the page with the lowest timestamp (as returned by 
vorbis_granule_time() and theora_granule_time()) and remove it
from its queue. If any queue is empty, compress more data until all 
queues are again full. 

Hope that helps,

More information about the Theora mailing list