mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	don't move streams to devices that are going away
Before a device is unlinked, the unlink hook is fired, and it's possible that a routing module tries to move streams to the unlinked device in that hook, because it doesn't know that the device is being unlinked. Of course, the unlinking is obvious when the code is in an unlink hook callback, but it's possible that some other module does something in the unlink hook that in turn triggers some other hook, and it's this second hook where the routing module may get confused. This patch adds an "unlink_requested" flag that is set before the unlink hook is fired, and moving streams to a device with that flag set is prevented. This patch is motivated by seeing module-device-manager moving a stream to a sink that was being unlinked. It was a complex case where an alsa card was changing its profile, while an echo-cancel sink was connected to the old alsa sink. module-always-sink loaded a null sink in the middle of the profile change, and after a stream had been rescued to the null sink, module-device-manager decided to move it back to the old alsa sink that was being unlinked. That move made no sense, so I came up with this patch.
This commit is contained in:
		
							parent
							
								
									0b6e4694a5
								
							
						
					
					
						commit
						13fc833387
					
				
					 6 changed files with 27 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -64,6 +64,12 @@ struct pa_source {
 | 
			
		|||
    pa_core *core;
 | 
			
		||||
 | 
			
		||||
    pa_source_state_t state;
 | 
			
		||||
 | 
			
		||||
    /* Set in the beginning of pa_source_unlink() before setting the source
 | 
			
		||||
     * state to UNLINKED. The purpose is to prevent moving streams to a source
 | 
			
		||||
     * that is about to be removed. */
 | 
			
		||||
    bool unlink_requested;
 | 
			
		||||
 | 
			
		||||
    pa_source_flags_t flags;
 | 
			
		||||
    pa_suspend_cause_t suspend_cause;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue