Skip to content

Commit

Permalink
ALSA: compress: Be more restrictive about when a drain is allowed
Browse files Browse the repository at this point in the history
Draining makes little sense in the situation of hardware overrun, as the
hardware will have consumed all its available samples. Additionally,
draining whilst the stream is paused would presumably get stuck as no
data is being consumed on the DSP side.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Charles Keepax authored and Takashi Iwai committed Jul 23, 2019
1 parent a70ab8a commit 3b81799
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/core/compress_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,10 @@ static int snd_compr_drain(struct snd_compr_stream *stream)
case SNDRV_PCM_STATE_OPEN:
case SNDRV_PCM_STATE_SETUP:
case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_PAUSED:
return -EPERM;
case SNDRV_PCM_STATE_XRUN:
return -EPIPE;
default:
break;
}
Expand Down Expand Up @@ -860,7 +863,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
case SNDRV_PCM_STATE_OPEN:
case SNDRV_PCM_STATE_SETUP:
case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_PAUSED:
return -EPERM;
case SNDRV_PCM_STATE_XRUN:
return -EPIPE;
default:
break;
}
Expand Down

0 comments on commit 3b81799

Please sign in to comment.