Skip to contentSkip to conversation

ALSA: pcm: Comment why read blocks when PCM is not running

PATCH Applied Ricardo Biehl Pasquali 2 participants 2 messages Feb 13, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: Comment why read blocks when PCM is not running

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.

---
 sound/core/pcm_lib.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/core/pcm_lib.c +4 -0
index bcb06bd3d..345ab1ab2 100644
@@ -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) {
Signature · 1 line
2.19.1
Applied
#1 lore raw
Quoted 9 lines · Ricardo Biehl Pasquali

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.

Applied, thanks.

Takashi