Help - Search - Members - Calendar
Full Version: Going back to beginning in non-seekable streams?
Hydrogenaudio Forums > Lossy Audio Compression > Ogg Vorbis > Ogg Vorbis - Tech
Rockin' Pete
What's the fastest way to go back to the beginning of a non-seekable Ogg/Vorbis stream?

I'd prefer not to have to reopen it because that can easily take 50ms on the slow mobile platform that starts with "i" that I'm working on. It can easily take a second to open an Ogg/Vorbis file as seekable, so we're opening all of our files as non-seekable. But we still need to loop them, and some of them are music files - a bit too big to decompress into memory.

m00
QUOTE(Rockin' Pete @ Jul 25 2008, 13:08) *

What's the fastest way to go back to the beginning of a non-seekable Ogg/Vorbis stream?

I'd prefer not to have to reopen it because that can easily take 50ms on the slow mobile platform that starts with "i" that I'm working on. It can easily take a second to open an Ogg/Vorbis file as seekable, so we're opening all of our files as non-seekable. But we still need to loop them, and some of them are music files - a bit too big to decompress into memory.


Can't you just cache the first few KBs of the stream when you first open it ? Then use that to decode from whilst the file is being re-opened in the background or something ? If you only need to cover 50ms or so then you'll need a tiny amount of memory to cache the start.. Even with a stream at 128Kb/s that's still only 16KB a second so 4K would cover you for easily a quarter of a second.. I don't know how much gumpf sits at the start of Ogg streams, but I can't imagine it's too much..
Rockin' Pete
The problem isn't the I/O. I'm using ov_open_callbacks and memory-mapped files. We have measured our I/O performance and found it to be very efficient - much faster than seeking.

Our product is an audio SDK for video games. We don't have the option of tying up the CPU for that long.

So there's no efficient way to jump back to the beginning of an Ogg/Vorbis file? Or at least, nothing faster than closing it and reopening it?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.