From ca8d119aadfef349ebbf5365f9a297354dae4976 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Wed, 3 Jul 2019 12:31:00 -0500 Subject: [PATCH] missed patch from prior commit --- ...ink-clear-pollfd-revents-before-poll.patch | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 0001-alsa-sink-clear-pollfd-revents-before-poll.patch diff --git a/0001-alsa-sink-clear-pollfd-revents-before-poll.patch b/0001-alsa-sink-clear-pollfd-revents-before-poll.patch new file mode 100644 index 0000000..5f91786 --- /dev/null +++ b/0001-alsa-sink-clear-pollfd-revents-before-poll.patch @@ -0,0 +1,40 @@ +From 0b3c52341d1d8d098f315302d6d3e1c40965493f Mon Sep 17 00:00:00 2001 +From: Kai Vehmanen +Date: Wed, 3 Jul 2019 17:09:51 +0300 +Subject: [PATCH] alsa-sink: clear pollfd revents before poll + +Always clear revents before calling snd_pcm_poll_descriptors_revents() +as the ALSA function will not clear out existing events. + +Without this, playback restart fails in the following +scenario: + +1. single stream PCM playback ongoing +2. system put to system suspend (S3), ALSA sink suspended +3. system resumes, ALSA sink restarted +4. upon first alsa-sink thread_func iteration, rtpoll + revents still hass POLLERR bits set (due to the suspend) +5. execution goes to pa_alsa_recover_from_poll() +6. snd_pcm_drop() is called and PCM is restarted +7. process loops from (4) and playback is never recovered + +Signed-off-by: Kai Vehmanen +--- + src/modules/alsa/alsa-sink.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c +index 4568a19c5..d96f19398 100644 +--- a/src/modules/alsa/alsa-sink.c ++++ b/src/modules/alsa/alsa-sink.c +@@ -1915,6 +1915,7 @@ static void thread_func(void *userdata) { + unsigned n; + + pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, &n); ++ pollfd->revents = 0; + + if ((err = snd_pcm_poll_descriptors_revents(u->pcm_handle, pollfd, n, &revents)) < 0) { + pa_log("snd_pcm_poll_descriptors_revents() failed: %s", pa_alsa_strerror(err)); +-- +2.21.0 +