[openal] FFmpeg + OpenAL - playback streaming sound from video won't work

Chris Robinson chris.kcat at gmail.com
Tue Jan 28 12:11:33 EST 2014

Glad you figured it out. :) I actually wish I could include an ffmpeg 
video player example with OpenAL Soft, but ffmpeg's constant API breaks 
makes that too impractical to do. :/

As for this bit:

> SDL seems to call a callback, requesting a number of bytes/buffers to be
> filled. But with OpenAL you need to put the complete audio stream in
> there and OpenAL does the skipping itself (otherwise that whole
> multi-buffering it does wouldn't make much sense). So you don't really
> need to do any audio synching with OpenAL if I got that correctly.

What I mean by synchronization is that the correct video frame is shown 
with the correct audio frame being heard. OpenAL will correctly play the 
samples you give it, but the timing of the audio stream may not be the 
same as the main system/video. Particularly when resampling is involved, 
the audio time can ever-so-slightly "drift", and that drift accumulates 
over time.

This is further complicated by how much delay there can be between 
queueing an audio frame onto a source and it being heard, or even the 
delay between the source offset and what's being heard (this was the 
main reason behind AL_SOFT_source_latency, to get more accurate 
positioning of what's being heard; it also tends to give a bit better 
granularity than OpenAL Soft's default ~22ms updates).

More information about the openal mailing list