Commit 30dd700d authored by Charles Keepax's avatar Charles Keepax Committed by Greg Kroah-Hartman

ALSA: compress: Don't allow paritial drain operations on capture streams

[ Upstream commit a70ab8a8 ]

Partial drain and next track are intended for gapless playback and
don't really have an obvious interpretation for a capture stream, so
makes sense to not allow those operations on capture streams.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f1ea9a63
...@@ -835,6 +835,10 @@ static int snd_compr_next_track(struct snd_compr_stream *stream) ...@@ -835,6 +835,10 @@ static int snd_compr_next_track(struct snd_compr_stream *stream)
if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING)
return -EPERM; return -EPERM;
/* next track doesn't have any meaning for capture streams */
if (stream->direction == SND_COMPRESS_CAPTURE)
return -EPERM;
/* you can signal next track if this is intended to be a gapless stream /* you can signal next track if this is intended to be a gapless stream
* and current track metadata is set * and current track metadata is set
*/ */
...@@ -862,6 +866,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) ...@@ -862,6 +866,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
break; break;
} }
/* partial drain doesn't have any meaning for capture streams */
if (stream->direction == SND_COMPRESS_CAPTURE)
return -EPERM;
/* stream can be drained only when next track has been signalled */ /* stream can be drained only when next track has been signalled */
if (stream->next_track == false) if (stream->next_track == false)
return -EPERM; return -EPERM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment