[gst-devel] oggdemux, chained streams and slow sources

Benjamin Otte in7y118 at public.uni-hamburg.de
Mon May 17 04:08:18 CEST 2004

On Sun, 16 May 2004, Andy Hanton wrote:

> The oggdemux plugin seems to read in the entire file before it starts
> playing in order to find all of the chained streams.  This isn't too bad
> when the file is local, but in my case it delays playback of a 5MB file
> by 20 seconds.  I would guess that reading a complete movie in theora
> format off of a file server on a 100mbit lan might take over a minutes.
This is pending optimization. Noone bothered to do it yet, because we all
just listen to local vorbis streams and that's fast enough.
The reason it is needed is to figure out the length of the stream we're
playing. All the playback applications want to know that or their sliders
won't work.
So to figure out the length of the currently played stream, oggdemux needs
to find the last page of this stream. The easy approach (both code-
and testingwise) is to parse the stream until we hit the last page. You
can obviously optimize this by seeking close to the end and only reading
the last 10k bytes in 90% of cases and that would solve yours and the
Theora issue, but it only works in 90% of cases. To get it really correct
you might to seek even further back (ogg pages may be up to 65k big and
you may parse a chained bitstream). Adding to this that seek events may
not be followed by a DISCONT instantly and you need resync code. So it
adds up to a lot that you need to do just to get this optimization done.
Feel free to do it though, I'll gladly apply patches that implement this,
because there's been a lot of people asking for it. :)
I'll even provide you with testfiles so you can check if the optimization

> >From a quick look at the ogg specification, reading the whole file isn't
> necessary unless the application intends to present the chained streams
> as a single song or movie.  I think that responsiveness is probably more
> important than the ability to play chained streams.  I don't think that
> the chained streams feature is very useful for users anyway.
> Would it be acceptable to turn off this feature?
If you provide a way to get the length of the played stream without
looking how long it is, I'll gladly turn this off, it's not that I think
it's cool or so. ;)


More information about the gstreamer-devel mailing list