mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	suspend-on-idle: use earlier (safer) hooks for stream unlink notifications
In the "unlink post" hook it's not guaranteed that the stream's old device exists any more, so let's use the "unlink" hook that is safer. For example, module-bluetooth-policy does a card profile change in the source-output "unlink post" hook, which invalidates the source-output's source pointer. When the "unlink" hook is fired, the stream is still linked to its device, which affects the return values of the check_suspend() functions. The unlinked streams should be ignored by the check_suspend() functions, so I had to add extra parameters to those functions.
This commit is contained in:
		
							parent
							
								
									2250dbfd69
								
							
						
					
					
						commit
						c3393d27a5
					
				
					 5 changed files with 39 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -1943,7 +1943,7 @@ unsigned pa_source_used_by(pa_source *s) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Called from main thread */
 | 
			
		||||
unsigned pa_source_check_suspend(pa_source *s) {
 | 
			
		||||
unsigned pa_source_check_suspend(pa_source *s, pa_source_output *ignore) {
 | 
			
		||||
    unsigned ret;
 | 
			
		||||
    pa_source_output *o;
 | 
			
		||||
    uint32_t idx;
 | 
			
		||||
| 
						 | 
				
			
			@ -1959,6 +1959,9 @@ unsigned pa_source_check_suspend(pa_source *s) {
 | 
			
		|||
    PA_IDXSET_FOREACH(o, s->outputs, idx) {
 | 
			
		||||
        pa_source_output_state_t st;
 | 
			
		||||
 | 
			
		||||
        if (o == ignore)
 | 
			
		||||
            continue;
 | 
			
		||||
 | 
			
		||||
        st = pa_source_output_get_state(o);
 | 
			
		||||
 | 
			
		||||
        /* We do not assert here. It is perfectly valid for a source output to
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue