I had to decode audio in vorbis format from a webm file, here are some notes on what is involved in the process.
First of all you need to extract the AudioTrack from the WebM file.
Then from an AudioTrack Extract the privateData from it getPrivateData(size);
This PrivateData is the Header that libvorbis needs to initialize the internals of the VorbisDecoder
The VorbisDecoder needs 3 Ogg packets. This ogg packets have to be extracted from the PrivateData.
You have to unpack them as described in
Vorbis 3 Packets Specification (Xiph Laced format)
Then you are ready to follow the process described in :
Vorbis Decoding worflow
Pay attention that the internal buffer is limited so you have to call vorbis_synthesis_pcmout
after vorbis_synthesis_blockin. Always check for the return values of this functions.
The buffer returned by vorbis_synthesis_pcmout is in FLOAT32. To covert them to int16 you have to
multiply by 2 ** 15 - 1 and then clip them between - 2 ** 15 and 2 ** 15.
Pay attention to the number of channels as the data is stored as sample_ch1, sample_ch2, sample_ch1, sample_ch2.
Have fun !