* [PATCH] ALSA: compress: Fix stop handling on compressed capture streams
@ 2019-02-05 16:29 Charles Keepax
2019-02-05 21:02 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2019-02-05 16:29 UTC (permalink / raw)
To: tiwai, vkoul; +Cc: patches, alsa-devel, broonie
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: 49bb6402f1aa ("ALSA: compress_core: Add support for capture streams")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
include/sound/compress_driver.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 0cdc3999ecfa8..c5188ff724d12 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -173,7 +173,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
if (snd_BUG_ON(!stream))
return;
- stream->runtime->state = SNDRV_PCM_STATE_SETUP;
+ if (stream->direction == SND_COMPRESS_PLAYBACK)
+ stream->runtime->state = SNDRV_PCM_STATE_SETUP;
+ else
+ stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
+
wake_up(&stream->runtime->sleep);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: compress: Fix stop handling on compressed capture streams
2019-02-05 16:29 [PATCH] ALSA: compress: Fix stop handling on compressed capture streams Charles Keepax
@ 2019-02-05 21:02 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-02-05 21:02 UTC (permalink / raw)
To: Charles Keepax; +Cc: patches, vkoul, broonie, alsa-devel
On Tue, 05 Feb 2019 17:29:40 +0100,
Charles Keepax wrote:
>
> 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: 49bb6402f1aa ("ALSA: compress_core: Add support for capture streams")
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Applied now (with Cc to stable). Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-05 21:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 16:29 [PATCH] ALSA: compress: Fix stop handling on compressed capture streams Charles Keepax
2019-02-05 21:02 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.