mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-10-29 05:40:23 -04:00 
			
		
		
		
	Recover stream when it's suspended upon rewind
Error from snd_pcm_rewind() might mean we just woke up from suspend and didn't have a chance to try to recover the stream since we didn't write to it in between. Call try_recover() in such cases. Note that for this to work kernel must return ESTRPIPE instead of EBADF for rewind/forward attempts on suspended streams, so that snd_pcm_recover() can recognize it should snd_pcm_resume() the stream. This is not the case yet (2.6.31-rc5), patch is available. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
This commit is contained in:
		
							parent
							
								
									277822053c
								
							
						
					
					
						commit
						34f31f666e
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -340,6 +340,9 @@ static int try_recover(struct userdata *u, const char *call, int err) { | |||
|     if (err == -EPIPE) | ||||
|         pa_log_debug("%s: Buffer underrun!", call); | ||||
| 
 | ||||
|     if (err == -EBADFD) | ||||
|         pa_log_debug("%s: Stream suspended!", call); | ||||
| 
 | ||||
|     if ((err = snd_pcm_recover(u->pcm_handle, err, 1)) < 0) { | ||||
|         pa_log("%s: %s", call, pa_alsa_strerror(err)); | ||||
|         return -1; | ||||
|  | @ -1199,8 +1202,11 @@ static int process_rewind(struct userdata *u) { | |||
|         pa_log_debug("before: %lu", (unsigned long) in_frames); | ||||
|         if ((out_frames = snd_pcm_rewind(u->pcm_handle, (snd_pcm_uframes_t) in_frames)) < 0) { | ||||
|             pa_log("snd_pcm_rewind() failed: %s", pa_alsa_strerror((int) out_frames)); | ||||
|             return -1; | ||||
|             if (try_recover(u, "process_rewind", out_frames) < 0) | ||||
|                 return -1; | ||||
|             out_frames = 0; | ||||
|         } | ||||
| 
 | ||||
|         pa_log_debug("after: %lu", (unsigned long) out_frames); | ||||
| 
 | ||||
|         rewind_nbytes = (size_t) out_frames * u->frame_size; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lubomir Rintel
						Lubomir Rintel