alsa: Improve resume logic after alsa suspend
authorGeorg Chini <georg@chini.tk>
Sat, 9 Mar 2019 19:19:34 +0000 (20:19 +0100)
committerArun Raghavan <arun@arunraghavan.net>
Mon, 25 Mar 2019 05:02:29 +0000 (05:02 +0000)
commitf7b3537bbf9a6916ee3fd72a82025519b4c346f5
treeebae49d1bf9992035f79d612f277018fe514c7ef
parente794d0a21af24ae3d2afae000ad67b17ef56ada2
alsa: Improve resume logic after alsa suspend

Currently, when a system is waking up from suspend, the resume process of the
ALSA sink and source is unstable. Sometimes the device needs to be restarted
multiple times and when the system was suspended between snd_pcm_mmap_begin()
and snd_pcm_mmap_commit(), pulseaudio crashes on resume.
Additionally, variables are not reset after the resume, so that sink/source
report wrong latencies.
This patch fixes the issues by closing and re-opening the PCM if recovery
from an error condition is not possible. Additionally, the variables are
reset, so that latencies are reported correctly.
src/modules/alsa/alsa-sink.c
src/modules/alsa/alsa-source.c
src/modules/alsa/alsa-util.c