Skip to contentSkip to conversation

ALSA: pcm: Don't issue XRUN during draining

PATCH New Takashi Iwai 1 participant 1 message Nov 25, 2024 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: Don't issue XRUN during draining

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")
---
 sound/core/pcm_native.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +2 -1
index 381a476a1045..7bcca443e333 100644
@@ -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;
 }
Signature · 1 line
2.43.0