[Vorbis-dev] Decode ogg file while downloading: what are the good practices?

Matthieu Regnauld mregnauld at gmail.com
Sat Nov 3 11:55:24 UTC 2018


Hello,

In my Android app, I implemented the libogg and libvorbis libraries, so I
can extract audio samples from an ogg file on the fly.

It works well when I extract samples from a local file, but my goal is to
be able to extract audio samples and seek in a file that is downloading (so
I can stream an audio file and process audio samples on the fly, from
anywhere in the file).

So here is the code I use, to extract audio samples from a downloading ogg
file (I keep it simple so it's easy to read):
https://gist.github.com/mregnauld/3f7cdc43b02ec3bbd91641b9333ba072
In that code, the oggFile  is the file that I download (using Java code).
So I start the download, and when there is some data available, I open the
file, seek in the file, and extract audio samples from the desired position.

And here is the problem: the ov_pcm_seek() function doesn't work properly
most of the time, when I seek in a file that is currently downloading, even
if I want to seek to a position that is already available (there is already
data in that position).

So, my question is: is it good practice or not? If not, how can I properly
manage samples extraction and seeking in a downloading file?

Thanks you very much for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/vorbis-dev/attachments/20181103/053c50cf/attachment.html>


More information about the Vorbis-dev mailing list