[pulseaudio-discuss] alsa-sink: fix revents bug when meet underrun

xing wang wangxingchao2011 at gmail.com
Thu Aug 4 20:02:48 PDT 2011


There's similar case for capture. So update the patch.


Date: Fri, 5 Aug 2011 10:33:17 -0400
Subject: [PATCH] alsa: resets POLLOUT event

revents marked as POLLOUT|POLLERR|POLLWRNORM in "underrun" case, that will
trigger unexpected log "ALSA woke us up to write new data to the device, but
there was acturally nothing to write...".
---
 src/modules/alsa/alsa-sink.c   |    1 +
 src/modules/alsa/alsa-source.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 0164040..ae86755 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1627,6 +1627,7 @@ static void thread_func(void *userdata) {

                 u->first = TRUE;
                 u->since_start = 0;
+                               revents = 0;
             } else if (revents && u->use_tsched &&
pa_log_ratelimit(PA_LOG_DEBUG))
                 pa_log_debug("Wakeup from ALSA!");

diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index f847b1e..11052c5 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1402,6 +1402,7 @@ static void thread_func(void *userdata) {
                     goto fail;

                 u->first = TRUE;
+                               revents = 0;
             } else if (revents && u->use_tsched &&
pa_log_ratelimit(PA_LOG_DEBUG))
                 pa_log_debug("Wakeup from ALSA!");

-- 
1.7.1

2011/8/4 xing wang <wangxingchao2011 at gmail.com>:
> From 92b3d70c259fdc5390661e9ef6236f0173704708 Mon Sep 17 00:00:00 2001
> From: xingchao <xingchao.wang at intel.com>
> Date: Wed, 13 Jul 2011 14:29:48 -0400
> Subject: [PATCH] reset revents if meet underrun case
>
> When meet underrun, driver will also report POLLOUT event masked with
> POLLOUT|POLLERR|POLLWRNORM, that doesnot mean "wake up pa to write data".
> So reset revents to 0 in case PA get confused.
> ---
>  src/modules/alsa/alsa-sink.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
> index c5ded40..dd2546c 100644
> --- a/src/modules/alsa/alsa-sink.c
> +++ b/src/modules/alsa/alsa-sink.c
> @@ -1594,6 +1594,7 @@ static void thread_func(void *userdata) {
>
>                 u->first = TRUE;
>                 u->since_start = 0;
> +                               revents = 0;
>                 pa_log_debug("Wakeup From Ayncmq!");
>             } else if (revents && u->use_tsched &&
> pa_log_ratelimit(PA_LOG_DEBUG))
>                 pa_log_debug("Wakeup from ALSA!");
> --
> 1.7.1
>


More information about the pulseaudio-discuss mailing list