Comment 21 for bug 451893

Revision history for this message
Dan McCombs (overridex) wrote :

Ok, I had some time to compile alsa-lib with debugging and poke at this a little more. From looking at it, it looks like alsa only opens these timers when using extra channels - like rear and center. So on 5.1 it's opening a timer for front, rear and center, while on 4.1 it opens one for rear and one for front. When pulseaudio suspends (when there hasn't been any audio played for 5 seconds) it calls snd_pcm_close and when it unsuspends (when sound is played again) it opens it back up. The problem is that the file handles for the timers are not being closed when snd_pcm_close is called, and more are opened back up when unsuspending. I'm no alsa or pulseaudio expert, so if any of this is off I apologize.

In any case, I was able to fix this by closing the timer in snd_pcm_hw_hw_free which is called for each slave when snd_pcm_close is called. With this change it works as expected, with the 3 file handles to the timer being open while pulseaudio is actively playing sound and 0 when it's not after a few seconds.

I've attached the patch as well as a patched package for amd64 and i386. I had some trouble compiling the lib32 packages on my machine for some reason (unrelated to this fix) so those are not included.

Hope this fixes it for others as well,

-Dan