mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink: Process rewind requests also when suspended.
When a rewind is requested on a sink input, the request parameters are stored in the pa_sink_input struct. The parameters are reset during rewind processing, and if the sink decides to ignore the rewind request due to being suspended, stale parameters are left in pa_sink_input. It's particularly problematic if the rewrite_bytes parameter is left at -1, because that will prevent all future rewind processing on that sink input. So, in order to avoid stale parameters, every rewind request needs to be processed, even if the sink is suspended. Reported-by: Uoti Urpala
This commit is contained in:
		
							parent
							
								
									cd1102cce0
								
							
						
					
					
						commit
						29f064aa3d
					
				
					 14 changed files with 58 additions and 61 deletions
				
			
		| 
						 | 
				
			
			@ -1608,6 +1608,11 @@ static int process_rewind(struct userdata *u) {
 | 
			
		|||
    size_t rewind_nbytes, unused_nbytes, limit_nbytes;
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
 | 
			
		||||
    if (!PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
 | 
			
		||||
        pa_sink_process_rewind(u->sink, 0);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Figure out how much we shall rewind and reset the counter */
 | 
			
		||||
    rewind_nbytes = u->sink->thread_info.rewind_nbytes;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1687,16 +1692,17 @@ static void thread_func(void *userdata) {
 | 
			
		|||
        pa_log_debug("Loop");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        if (PA_UNLIKELY(u->sink->thread_info.rewind_requested)) {
 | 
			
		||||
            if (process_rewind(u) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* Render some data and write it to the dsp */
 | 
			
		||||
        if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
 | 
			
		||||
            int work_done;
 | 
			
		||||
            pa_usec_t sleep_usec = 0;
 | 
			
		||||
            pa_bool_t on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll);
 | 
			
		||||
 | 
			
		||||
            if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
 | 
			
		||||
                if (process_rewind(u) < 0)
 | 
			
		||||
                        goto fail;
 | 
			
		||||
 | 
			
		||||
            if (u->use_mmap)
 | 
			
		||||
                work_done = mmap_write(u, &sleep_usec, revents & POLLOUT, on_timeout);
 | 
			
		||||
            else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue