Skip to contentSkip to conversation

ALSA: pcm: Don't leave PREPARED state after draining

PATCH New Takashi Iwai 1 participant 1 message Dec 18, 2014 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: Don't leave PREPARED state after draining

When a PCM draining is performed to an empty stream that has been already in PREPARED state, the current code just ignores and leaves as it is, although the drain is supposed to set all such streams to SETUP state. This patch covers that overlooked case.

---
 sound/core/pcm_native.c | 2 ++
 1 file changed, 2 insertions(+)
sound/core/pcm_native.c +2 -0
index 095d9572ad2b..64d9863d6565 100644
@@ -1546,6 +1546,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
 			if (! snd_pcm_playback_empty(substream)) {
 				snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING);
 				snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING);
+			} else {
+				runtime->status->state = SNDRV_PCM_STATE_SETUP;
 			}
 			break;
 		case SNDRV_PCM_STATE_RUNNING:
Signature · 1 line
2.2.0