Skip to content

Commit a70ab8a

Browse files
charleskeepaxtiwai
authored andcommitted
ALSA: compress: Don't allow paritial drain operations on capture streams
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: Charles Keepax <[email protected]> Acked-by: Vinod Koul <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 26c3f15 commit a70ab8a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sound/core/compress_offload.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,10 @@ static int snd_compr_next_track(struct snd_compr_stream *stream)
834834
if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING)
835835
return -EPERM;
836836

837+
/* next track doesn't have any meaning for capture streams */
838+
if (stream->direction == SND_COMPRESS_CAPTURE)
839+
return -EPERM;
840+
837841
/* you can signal next track if this is intended to be a gapless stream
838842
* and current track metadata is set
839843
*/
@@ -861,6 +865,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
861865
break;
862866
}
863867

868+
/* partial drain doesn't have any meaning for capture streams */
869+
if (stream->direction == SND_COMPRESS_CAPTURE)
870+
return -EPERM;
871+
864872
/* stream can be drained only when next track has been signalled */
865873
if (stream->next_track == false)
866874
return -EPERM;

0 commit comments

Comments
 (0)