mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	loopback: Restart timer after 1/3 second
After switching source or sink, call adjust_rates after a third of a second instead of waiting one full adjust time. This will ensure that latency regulation starts as soon as possible.
This commit is contained in:
		
							parent
							
								
									919cc2f3f9
								
							
						
					
					
						commit
						4a11742652
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -251,13 +251,16 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
 | 
			
		|||
    adjust_rates(u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Called from main context */
 | 
			
		||||
/* Called from main context
 | 
			
		||||
 * When source or sink changes, give it a third of a second to settle down, then call adjust_rates for the first time */
 | 
			
		||||
static void enable_adjust_timer(struct userdata *u, bool enable) {
 | 
			
		||||
    if (enable) {
 | 
			
		||||
        if (u->time_event || u->adjust_time <= 0)
 | 
			
		||||
        if (!u->adjust_time)
 | 
			
		||||
            return;
 | 
			
		||||
        if (u->time_event)
 | 
			
		||||
            u->core->mainloop->time_free(u->time_event);
 | 
			
		||||
 | 
			
		||||
        u->time_event = pa_core_rttime_new(u->module->core, pa_rtclock_now() + u->adjust_time, time_callback, u);
 | 
			
		||||
        u->time_event = pa_core_rttime_new(u->module->core, pa_rtclock_now() + 333 * PA_USEC_PER_MSEC, time_callback, u);
 | 
			
		||||
    } else {
 | 
			
		||||
        if (!u->time_event)
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue