All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 2/2] plugio: Check for pointer callback error codes
Date: Mon, 23 Aug 2021 17:12:32 +0200	[thread overview]
Message-ID: <s5htujg2o0v.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAGFh025WJ3uCfiE=2vYYd=gzwY690iokjvTD1GQ_G+e2aT4X6g@mail.gmail.com>

On Mon, 23 Aug 2021 13:48:38 +0200,
Arkadiusz Bokowy wrote:
> 
> By checking error code returned by the pointer callback, we can
> determine more precisely PCM state. Previous implementation assumed,
> that a software PCM can only produce overrun or underrun. It was
> impossible to mark software PCM as disconnected.
> 
> Signed-off-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>

Please fix MUA setup.

Also...

> ---
>  src/pcm/pcm_ioplug.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
> index c96104e9..0e27e121 100644
> --- a/src/pcm/pcm_ioplug.c
> +++ b/src/pcm/pcm_ioplug.c
> @@ -81,11 +81,21 @@ static int snd_pcm_ioplug_hw_ptr_update(snd_pcm_t *pcm)
>   }
>   io->last_hw = (snd_pcm_uframes_t)hw;
>   } else {
> + switch (hw) {
> + case -ESTRPIPE:
> + io->data->state = SND_PCM_STATE_SUSPENDED;
> + break;
> + case -ENODEV:
> + io->data->state = SND_PCM_STATE_DISCONNECTED;
> + break;
> + default:
> + io->data->state = SND_PCM_STATE_XRUN;
> + }
>   if (io->data->state == SND_PCM_STATE_DRAINING)
>   snd_pcm_ioplug_drop(pcm);
>   else
>   io->data->state = SNDRV_PCM_STATE_XRUN;
> - return -EPIPE;
> + return hw;

Be careful about the handling of the draining case.


thanks,

Takashi

      reply	other threads:[~2021-08-23 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 11:48 [PATCH 2/2] plugio: Check for pointer callback error codes Arkadiusz Bokowy
2021-08-23 15:12 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5htujg2o0v.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=arkadiusz.bokowy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.