Matthieu Regnauld
2018-Nov-03 11:55 UTC
[Vorbis-dev] Decode ogg file while downloading: what are the good practices?
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>
Gunter Königsmann
2018-Nov-03 12:14 UTC
[Vorbis-dev] Decode ogg file while downloading: what are the good practices?
What I have experienced is that many files you can download or stream in the internet use random numbers as timestamp which means they playback Ok, but seeking is broken unless you provide all packets with a working timestamp. For a program that does do so see https://launchpad.net/oggfix/+download Kind regards, Gunter. -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/vorbis-dev/attachments/20181103/0be7d5a8/attachment.html>
Matthieu Regnauld
2018-Nov-03 12:32 UTC
[Vorbis-dev] Decode ogg file while downloading: what are the good practices?
Thanks for your answer. But as I said, I don't have any problem seeking in a local file. Also, I have full control on the ogg file I play, since I encode it by myself. I first would like to know if the code I provided ( https://gist.github.com/mregnauld/3f7cdc43b02ec3bbd91641b9333ba072) is good practice when it comes to extracting and seeking in a file that is being downloaded. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/vorbis-dev/attachments/20181103/9a0faf18/attachment.html>