[vlc-devel] [PATCH] Fix ALSA hda audio on Linux kernel 3.2

Edward Sheldrake ejsheldrake at gmail.com
Sun Feb 19 09:29:26 CET 2012


Since Linux kernel 3.2, I started getting the "hda-intel: IRQ timing
workaround" [1] warning message on first playing audio.

I investigated this a bit, and discovered that you could get rid of
the message by restoring the previous behaviour of the ALSA
snd-hda-intel driver, by using the align_buffer_size module parameter.
Or at least you used to be able to, until a change in linux kernel
3.2.4 stopped the align_buffer_size parameter working fully (it can't
restore the old behaviour if the driver enables the new).

With a patch to fix the align_buffer_size module parameter, things I
normally use: mplayer, madplay, mpg123 all worked fine, but VLC failed
to initialize the ALSA audio output module when trying to play sources
with 44100 Hz audio, resulting in no sound. I don't use pulseaudio nor
the alsa dmix plugin. VLC verbose output:

alsa audio output debug: using ALSA device: default
alsa audio output debug: Hardware PCM card 0 'HDA Intel' device 0 subdevice 0
alsa audio output debug: device name : ALC268 Analog
alsa audio output debug: device ID : ALC268 Analog
alsa audio output debug: subdevice name: subdevice #0

alsa audio output debug: initial hardware setup:
ACCESS: MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT: S16_LE S32_LE
SUBFORMAT: STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [32 64]
CHANNELS: 2
RATE: [44100 192000]
PERIOD_TIME: (83 11888617)
PERIOD_SIZE: [16 524288]
PERIOD_BYTES: [128 4194304]
PERIODS: [2 32]
BUFFER_TIME: (166 23777234)
BUFFER_SIZE: [32 1048576]
BUFFER_BYTES: [128 4194304]
TICK_TIME: ALL
alsa audio output warning: cannot set buffer duration near 3000000 us:
Invalid argument
alsa audio output warning: cannot set buffer duration: Invalid argument
alsa audio output warning: cannot set minimum of 2 periods: No such
file or directory
alsa audio output warning: cannot set periods count near 2: No such
file or directory
alsa audio output error: cannot commit hardware parameters: Invalid argument

I initially experimented with different values instead of 3000000 in
VLC's alsa module, which maybe fixed 44100 Hz audio but broke 48000
Hz.

The attached patch appears to fix the problem, by moving the set min
periods to before setting the buffer duration.

Link to ALSA bug:

1. https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5513
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ALSA-set-min-periods-before-buffer-time.patch
Type: text/x-patch
Size: 2128 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120219/2c1a0710/attachment.bin>


More information about the vlc-devel mailing list