aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2009-08-02 12:14:44 -0400
committerTakashi Iwai <tiwai@suse.de>2009-08-03 02:57:00 -0400
commit51840409b6c928eead140157d4e9fc267f50caf9 (patch)
tree8729ed1b55b298c3491f286c70060329e7366efb /sound
parent4be3bd7849165e7efa6b0b35a23d6a3598d97465 (diff)
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: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_native.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index ac2150e0670d..d89c816ae5bf 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2208,6 +2208,9 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *subst
2208 case SNDRV_PCM_STATE_XRUN: 2208 case SNDRV_PCM_STATE_XRUN:
2209 ret = -EPIPE; 2209 ret = -EPIPE;
2210 goto __end; 2210 goto __end;
2211 case SNDRV_PCM_STATE_SUSPENDED:
2212 ret = -ESTRPIPE;
2213 goto __end;
2211 default: 2214 default:
2212 ret = -EBADFD; 2215 ret = -EBADFD;
2213 goto __end; 2216 goto __end;
@@ -2253,6 +2256,9 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substr
2253 case SNDRV_PCM_STATE_XRUN: 2256 case SNDRV_PCM_STATE_XRUN:
2254 ret = -EPIPE; 2257 ret = -EPIPE;
2255 goto __end; 2258 goto __end;
2259 case SNDRV_PCM_STATE_SUSPENDED:
2260 ret = -ESTRPIPE;
2261 goto __end;
2256 default: 2262 default:
2257 ret = -EBADFD; 2263 ret = -EBADFD;
2258 goto __end; 2264 goto __end;
@@ -2299,6 +2305,9 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *subs
2299 case SNDRV_PCM_STATE_XRUN: 2305 case SNDRV_PCM_STATE_XRUN:
2300 ret = -EPIPE; 2306 ret = -EPIPE;
2301 goto __end; 2307 goto __end;
2308 case SNDRV_PCM_STATE_SUSPENDED:
2309 ret = -ESTRPIPE;
2310 goto __end;
2302 default: 2311 default:
2303 ret = -EBADFD; 2312 ret = -EBADFD;
2304 goto __end; 2313 goto __end;
@@ -2345,6 +2354,9 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *subst
2345 case SNDRV_PCM_STATE_XRUN: 2354 case SNDRV_PCM_STATE_XRUN:
2346 ret = -EPIPE; 2355 ret = -EPIPE;
2347 goto __end; 2356 goto __end;
2357 case SNDRV_PCM_STATE_SUSPENDED:
2358 ret = -ESTRPIPE;
2359 goto __end;
2348 default: 2360 default:
2349 ret = -EBADFD; 2361 ret = -EBADFD;
2350 goto __end; 2362 goto __end;