Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: pcm: Don't issue XRUN during draining
@ 2024-11-25 14:57 Takashi Iwai
  0 siblings, 0 replies; only message in thread
From: Takashi Iwai @ 2024-11-25 14:57 UTC (permalink / raw)
  To: linux-sound

snd_pcm_stop_xrun() checks the stream status with snd_pcm_running()
helper, but this isn't really correct; namely, snd_pcm_running()
returns true also when the stream is in draining, but in principle,
the xrun at draining means nothing but the draining finished.  Hence,
we shouldn't issue XRUN when it happens during draining.

That is, for a proper state check, we should check the state only for
SNDRV_PCM_STATE_RUNNING, instead.

Fixes: 1fb8510cdb5b ("ALSA: pcm: Add snd_pcm_stop_xrun() helper")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/pcm_native.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 381a476a1045..7bcca443e333 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1577,7 +1577,8 @@ int snd_pcm_drain_done(struct snd_pcm_substream *substream)
 int snd_pcm_stop_xrun(struct snd_pcm_substream *substream)
 {
 	guard(pcm_stream_lock_irqsave)(substream);
-	if (substream->runtime && snd_pcm_running(substream))
+	if (substream->runtime &&
+	    substream->runtime->state == SNDRV_PCM_STATE_RUNNING)
 		__snd_pcm_xrun(substream);
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-25 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 14:57 [PATCH] ALSA: pcm: Don't issue XRUN during draining Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox