diff options
author | Vinod Koul <vkoul@kernel.org> | 2020-06-29 19:17:37 +0530 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-07-07 11:52:18 +0200 |
commit | f79a732a8325dfbd570d87f1435019d7e5501c6d (patch) | |
tree | 31e2f525140ee6c43d39077461016d26527e1bf0 /sound/core | |
parent | b6a1e78b96a5d7f312f08b3a470eb911ab5feec0 (diff) | |
download | linux-f79a732a8325dfbd570d87f1435019d7e5501c6d.tar.gz linux-f79a732a8325dfbd570d87f1435019d7e5501c6d.tar.bz2 linux-f79a732a8325dfbd570d87f1435019d7e5501c6d.zip |
ALSA: compress: fix partial_drain completion state
On partial_drain completion we should be in SNDRV_PCM_STATE_RUNNING
state, so set that for partially draining streams in
snd_compr_drain_notify() and use a flag for partially draining streams
While at it, add locks for stream state change in
snd_compr_drain_notify() as well.
Fixes: f44f2a5417b2 ("ALSA: compress: fix drain calls blocking other compress functions (v6)")
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20200629134737.105993-4-vkoul@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/compress_offload.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 509290f2efa8..0e53f6f31916 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -764,6 +764,9 @@ static int snd_compr_stop(struct snd_compr_stream *stream) retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); if (!retval) { + /* clear flags and stop any drain wait */ + stream->partial_drain = false; + stream->metadata_set = false; snd_compr_drain_notify(stream); stream->runtime->total_bytes_available = 0; stream->runtime->total_bytes_transferred = 0; @@ -921,6 +924,7 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) if (stream->next_track == false) return -EPERM; + stream->partial_drain = true; retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN); if (retval) { pr_debug("Partial drain returned failure\n"); |