diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2019-07-22 10:24:36 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-16 10:12:47 +0200 |
commit | b065f404c946804a4cca28f483e1dd9b343395ee (patch) | |
tree | 22513777fcd1f54b1b880fe5bec894b6a9c6abd9 /sound | |
parent | 30dd700da7de7b1c4f382a7a8637ccc4cae506b9 (diff) | |
download | linux-stable-b065f404c946804a4cca28f483e1dd9b343395ee.tar.gz linux-stable-b065f404c946804a4cca28f483e1dd9b343395ee.tar.bz2 linux-stable-b065f404c946804a4cca28f483e1dd9b343395ee.zip |
ALSA: compress: Be more restrictive about when a drain is allowed
[ Upstream commit 3b8179944cb0dd53e5223996966746cdc8a60657 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/compress_offload.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 9c1684f01aca..516ec3587325 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -812,7 +812,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; } @@ -861,7 +864,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; } |