ALSA: pcm: Don't leave PREPARED state after draining
authorTakashi Iwai <[email protected]>
Thu, 18 Dec 2014 09:02:41 +0000 (10:02 +0100)
committerTakashi Iwai <[email protected]>
Mon, 23 Feb 2015 15:48:18 +0000 (16:48 +0100)
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.

Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
sound/core/pcm_native.c

index b03a638b420c18243776c45fda5884b422392c46..279e24f613051fddb8ca16375ab9031e6a703b03 100644 (file)
@@ -1552,6 +1552,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: