Skip to content

Commit 4f2ab5e

Browse files
charleskeepaxtiwai
authored andcommitted
ALSA: compress: Fix stop handling on compressed capture streams
It is normal user behaviour to start, stop, then start a stream again without closing it. Currently this works for compressed playback streams but not capture ones. The states on a compressed capture stream go directly from OPEN to PREPARED, unlike a playback stream which moves to SETUP and waits for a write of data before moving to PREPARED. Currently however, when a stop is sent the state is set to SETUP for both types of streams. This leaves a capture stream in the situation where a new start can't be sent as that requires the state to be PREPARED and a new set_params can't be sent as that requires the state to be OPEN. The only option being to close the stream, and then reopen. Correct this issues by allowing snd_compr_drain_notify to set the state depending on the stream direction, as we already do in set_params. Fixes: 49bb640 ("ALSA: compress_core: Add support for capture streams") Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 3bff240 commit 4f2ab5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/sound/compress_driver.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
173173
if (snd_BUG_ON(!stream))
174174
return;
175175

176-
stream->runtime->state = SNDRV_PCM_STATE_SETUP;
176+
if (stream->direction == SND_COMPRESS_PLAYBACK)
177+
stream->runtime->state = SNDRV_PCM_STATE_SETUP;
178+
else
179+
stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
180+
177181
wake_up(&stream->runtime->sleep);
178182
}
179183

0 commit comments

Comments
 (0)