Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sylvain.bertrand@gmail.com
To: Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] fix snd_pcm_drain() excluding SETUP state from valid states
Date: Thu, 14 May 2020 21:06:07 +0000	[thread overview]
Message-ID: <20200514210607.GA6081@freedom> (raw)
In-Reply-To: <47281cd6-2ae5-309e-f1a9-8906ff50c9cc@perex.cz>

On Thu, May 14, 2020 at 03:52:25PM +0200, Jaroslav Kysela wrote:
> NAK: You should not call drain when the PCM handle is in the SETUP field.
> It's an obvious caller problem. The streaming should be active somehow.

The pb here is the non-blocking calls of the drain function: in my test case,
the first call to the drain function switches the pcm in draining state, but
the pcm will be switched to the setup state somewhen in between 2 drain function
calls! Naively, I was calling the drain function on a regular time basis to see
if the draining was finished, namely expecting 0 to be returned.

Then if I understood you well, the right way(tm) to use the drain function in
non-block mode, is to call only once the drain function, then inspect the state
of the pcm till it not anymore in the draining state. 

Am I right? Or did I miss something again?

regards,

-- 
Sylvain

  reply	other threads:[~2020-05-14 21:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02 19:33 [PATCH] fix snd_pcm_drain() excluding SETUP state from valid states sylvain.bertrand
2020-05-14 12:43 ` sylvain.bertrand
2020-05-14 13:52 ` Jaroslav Kysela
2020-05-14 21:06   ` sylvain.bertrand [this message]
2020-06-03 16:50     ` Jaroslav Kysela
2020-05-15 11:24   ` [PATCH] augment snd_pcm_drain() documentation regarding its non-blocking mode usage sylvain.bertrand
2020-06-01 11:50     ` sylvain.bertrand

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=20200514210607.GA6081@freedom \
    --to=sylvain.bertrand@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox