提交 b065f404 编写于 作者: C Charles Keepax 提交者: Greg Kroah-Hartman

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: NCharles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: NVinod Koul <vkoul@kernel.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 30dd700d
...@@ -812,7 +812,10 @@ static int snd_compr_drain(struct snd_compr_stream *stream) ...@@ -812,7 +812,10 @@ static int snd_compr_drain(struct snd_compr_stream *stream)
case SNDRV_PCM_STATE_OPEN: case SNDRV_PCM_STATE_OPEN:
case SNDRV_PCM_STATE_SETUP: case SNDRV_PCM_STATE_SETUP:
case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_PAUSED:
return -EPERM; return -EPERM;
case SNDRV_PCM_STATE_XRUN:
return -EPIPE;
default: default:
break; break;
} }
...@@ -861,7 +864,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) ...@@ -861,7 +864,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
case SNDRV_PCM_STATE_OPEN: case SNDRV_PCM_STATE_OPEN:
case SNDRV_PCM_STATE_SETUP: case SNDRV_PCM_STATE_SETUP:
case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_PAUSED:
return -EPERM; return -EPERM;
case SNDRV_PCM_STATE_XRUN:
return -EPIPE;
default: default:
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册