提交 51840409 编写于 作者: L Lubomir Rintel 提交者: Takashi Iwai

ALSA: pcm - Tell user that stream to be rewound is suspended

Return STRPIPE instead of EBADF when userspace attempts to rewind
of forward a stream that was suspended in meanwhile, so that it
can be recovered by snd_pcm_recover().

This was causing Pulseaudio to unload the ALSA sink module under a race
condition when it attempted to rewind the stream right after resume from
suspend, before writing to the stream which would cause it to revive the
stream otherwise. Tested to work with Pulseaudio patched to attempt to
snd_pcm_recover() upon receiving an error from snd_pcm_rewind().
Signed-off-by: NLubomir Rintel <lkundrak@v3.sk>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 4be3bd78
......@@ -2208,6 +2208,9 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *subst
case SNDRV_PCM_STATE_XRUN:
ret = -EPIPE;
goto __end;
case SNDRV_PCM_STATE_SUSPENDED:
ret = -ESTRPIPE;
goto __end;
default:
ret = -EBADFD;
goto __end;
......@@ -2253,6 +2256,9 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substr
case SNDRV_PCM_STATE_XRUN:
ret = -EPIPE;
goto __end;
case SNDRV_PCM_STATE_SUSPENDED:
ret = -ESTRPIPE;
goto __end;
default:
ret = -EBADFD;
goto __end;
......@@ -2299,6 +2305,9 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *subs
case SNDRV_PCM_STATE_XRUN:
ret = -EPIPE;
goto __end;
case SNDRV_PCM_STATE_SUSPENDED:
ret = -ESTRPIPE;
goto __end;
default:
ret = -EBADFD;
goto __end;
......@@ -2345,6 +2354,9 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *subst
case SNDRV_PCM_STATE_XRUN:
ret = -EPIPE;
goto __end;
case SNDRV_PCM_STATE_SUSPENDED:
ret = -ESTRPIPE;
goto __end;
default:
ret = -EBADFD;
goto __end;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册