[vlc-devel] alsa output: stuttering when playing 5.1 audio

Matthias vlc at mefju.mine.nu
Tue Jan 15 20:26:29 CET 2008


Thanks for this nice player. I watched movies, but when I tried 5.1
audio I got stuttering audio and the debug message "Alsa: broken pipe"
or similar. And i found the fix - could some of you apply my patch?

Error description:
VLC 0.8.6c plays audio directly to alsa (1.0.14) on Linux The
alsa device is the default one. An .AC3 file with audio 5.1 is opened
and in vlc 5.1 is chosen as audio-device. Then stuttering occurs and an
error message saying something about a broken thing appears.

Turning debugging on and additional hacking reveals:
- the buffersize is reported as of 5461 bytes, which violates alignment
requirements for 16-bit sound.
- as 1024*32 / 6 (number of channels) it should be 5461.333 ... 8-(
- this seems to have caused some buffer underruns -> hence the "broken
pipe" error message.

Fix: the patch http://paste.videolan.org/2955
It exchanges setting the period_size and buffer_size around line 570.
When the buffer_size is set as the last action it takes care of the 6
channels and allocates a buffersize that is appropriate (not a power of
2) for all channels. It seems, when buffersize is set first, and then
the number of channels that the alsa does not correct the buffersize,
hence the broken number 5461.333 and the underrun.

best regards


More information about the vlc-devel mailing list