GNOME Bugzilla – Bug 143222
[oggdemux] Optimize tag reading
Last modified: 2004-12-22 21:47:04 UTC
When using a pipeline like this: filesrc ! oggdemux ! vorbistag ! fakesink (which is useful for tag reading), oggdemux first reads the whole file and then seeks back to the beginning before pushing and buffers to vorbistag. This makes it take approximately 2000 iterations (and 200 ms on my box) before vorbistag even can see the tags! It doesn't matter a lot for playing the file, 200 ms is acceptable (but not optimal) but for something like tag reading when importing your whole database, this is quite critical for performance. A solution which was mentioned by Benjamin on irc involves checking the first page of the stream and save the serial number, then seek to the end without reading all the pages and find the last page and compare the serial number of the oggstream and read the length (by calling ogg_page_granulepos) and seek back to the beginning and push the tags.
With bigger .ogg files it matters for playing as well. I have quite a lot of 70-150 MB .ogg files (whole albums in one file), and whenever I play one of those files, it takes around 3-6 seconds before it even starts playing (2-3 secs if the file is cached in memory). Does oggdemux need to know the exact length for anything? Would it be possible to add a property that makes it skip the stream length finding process as a dirty hack if this can't be solved otherwise? (e.g for music players that have already imported the file and know the length) Cheers -Tim
This should be quite a lot faster after the recent reorganization of the setup code. It benchmarks at about 0.06 seconds until playback starts for normal ogg files. So I'm closing this as fixed.