diff mbox series

ALSA: pcm: Don't issue XRUN during draining

Message ID 20241125145757.22891-1-tiwai@suse.de (mailing list archive)
State New
Headers show
Series ALSA: pcm: Don't issue XRUN during draining | expand

Commit Message

Takashi Iwai Nov. 25, 2024, 2:57 p.m. UTC
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 mbox series

Patch

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;
 }