mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	device-port: moving streams since active_port on source changes status
When the active port of a source becomes unavailable, all streams from that source should be moved to the default source. When the active port of a source changes state from unavailable, all streams that have their preferred_source set to this source should be moved to this source. Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
		
							parent
							
								
									1cea7ab38d
								
							
						
					
					
						commit
						976a366c9f
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		| 
						 | 
					@ -110,6 +110,16 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) {
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                    pa_core_move_streams_to_newly_available_preferred_sink(p->core, sink);
 | 
					                    pa_core_move_streams_to_newly_available_preferred_sink(p->core, sink);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            pa_source *source;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            source = pa_device_port_get_source(p);
 | 
				
			||||||
 | 
					            if (source && p == source->active_port) {
 | 
				
			||||||
 | 
					                if (source->active_port->available == PA_AVAILABLE_NO)
 | 
				
			||||||
 | 
					                    pa_source_move_streams_to_default_source(p->core, source);
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    pa_core_move_streams_to_newly_available_preferred_source(p->core, source);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_subscription_post(p->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
 | 
					        pa_subscription_post(p->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
 | 
				
			||||||
| 
						 | 
					@ -249,3 +259,16 @@ pa_sink *pa_device_port_get_sink(pa_device_port *p) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    return rs;
 | 
					    return rs;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pa_source *pa_device_port_get_source(pa_device_port *p) {
 | 
				
			||||||
 | 
					    pa_source *rs = NULL;
 | 
				
			||||||
 | 
					    pa_source *source;
 | 
				
			||||||
 | 
					    uint32_t state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PA_IDXSET_FOREACH(source, p->card->sources, state)
 | 
				
			||||||
 | 
					        if (p == pa_hashmap_get(source->ports, p->name)) {
 | 
				
			||||||
 | 
					            rs = source;
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    return rs;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,4 +89,6 @@ pa_device_port *pa_device_port_find_best(pa_hashmap *ports);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pa_sink *pa_device_port_get_sink(pa_device_port *p);
 | 
					pa_sink *pa_device_port_get_sink(pa_device_port *p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pa_source *pa_device_port_get_source(pa_device_port *p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue