mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink/source: Don't update default sink/source before calling PA_CORE_HOOK_{SINK,SOURCE}_PUT
In sink_put() and source_put(), pa_core_update_default_{sink,source}() was called
before the PA_CORE_HOOK_{SINK,SOURCE}_PUT hook. Therefore module-switch-on-connect
could not correctly determine the old default sink/source if no user default was
set and a sink/source with higher priority than any other sink/source turned up.
This patch corrects the problem by swapping the order of the hook call and the
pa_core_update_default_sink() call.
Additionally it corrects a problem in module-switch-on-connect. If, after the
change above, the new sink/source was the first sink/source to appear, pulseaudio
would crash because module-switch-on-connect assumed that the default sink/source
was not NULL. The patch checks if the default sink/source is NULL and only sets
the new default sink/source in that case.
			
			
This commit is contained in:
		
							parent
							
								
									edc465da77
								
							
						
					
					
						commit
						e08124f6ba
					
				
					 3 changed files with 20 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -603,10 +603,12 @@ void pa_source_put(pa_source *s) {
 | 
			
		|||
    else
 | 
			
		||||
        pa_assert_se(source_set_state(s, PA_SOURCE_IDLE) == 0);
 | 
			
		||||
 | 
			
		||||
    pa_core_update_default_source(s->core);
 | 
			
		||||
 | 
			
		||||
    pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index);
 | 
			
		||||
    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_PUT], s);
 | 
			
		||||
 | 
			
		||||
    /* This function must be called after the PA_CORE_HOOK_SOURCE_PUT hook,
 | 
			
		||||
     * because module-switch-on-connect needs to know the old default source */
 | 
			
		||||
    pa_core_update_default_source(s->core);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Called from main context */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue