Skip to content

alsa: make the unsuspend more robust

Hui Wang requested to merge jason77wang/pulseaudio:unsuspend into master

We met a weird situation on a couple of Lenovo machines and at least on one Dell machine. First we open the gnome-sound-setting, then suspend and resume the system, after the system resume back, the audio devices change to dummy, the audio doesn't work anymore. And pacmd list-cards shows no available sound card.

Through debugging I found after resume, the alsa receives POLLERR events and it will call unsuspend to recover the pcm, but at that moment, the device nodes in /dev/snd/ is not accessible, so the snd_pcm_open() fails and the pulseaudio unload the module-alsa-card.

Here I add retry and pa_msleep if snd_pcm_open fails, I tested it on all machines which have this problem, pa_msleep(25) is ok for most of them, there is only one machine which needs to call pa_msleep(25) twice, so for safety reason, I set the max retry times to 4.

Signed-off-by: Hui Wang hui.wang@canonical.com

This issue doesn't happen before the commit f7b3537b wrote by @gchini

And attach a file bad.txt, it contains the pa log when problem happens.bad.txt

Edited by Hui Wang

Merge request reports