All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH] ALSA: pcm: Comment why read blocks when PCM is not running
Date: Wed, 13 Feb 2019 00:57:51 -0200	[thread overview]
Message-ID: <20190213025751.GA6024@localhost.localdomain> (raw)

This avoids bringing back the problem introduced by
62ba568f7aef ("ALSA: pcm: Return 0 when size <
start_threshold in capture") and fixed in 00a399cad1a0
("ALSA: pcm: Revert capture stream behavior change in
blocking mode"), which prevented the user from starting
capture from another thread.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
---
 sound/core/pcm_lib.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index bcb06bd3d..345ab1ab2 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -2176,6 +2176,10 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
 	if (runtime->status->state == SNDRV_PCM_STATE_RUNNING)
 		snd_pcm_update_hw_ptr(substream);
 
+	/*
+	 * If size < start_threshold, wait indefinitely. Another
+	 * thread may start capture
+	 */
 	if (!is_playback &&
 	    runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
 	    size >= runtime->start_threshold) {
-- 
2.19.1

             reply	other threads:[~2019-02-13  2:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  2:57 Ricardo Biehl Pasquali [this message]
2019-02-13  7:03 ` [PATCH] ALSA: pcm: Comment why read blocks when PCM is not running Takashi Iwai

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=20190213025751.GA6024@localhost.localdomain \
    --to=pasqualirb@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.