mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	device-manager, filter-apply: don't reroute streams that have a filter
device-manager reroutes all streams whenever a new device appears. When filter-apply has loaded a filter for some stream, the filter device may not be what device-manager considers the best device for the stream, which means that when an unrelated device appears, device-manager may break the filtering that filter-apply had set up. This patch changes filter-apply so that it saves the filter device name to the stream proplist when it sets up a filter. device-manager can then check the proplist when it does rerouting, and skip the rerouting for streams that have a filter applied to them. The proplist isn't cleaned up when the stream moves away from the filter device, so before doing any decisions based on the filter_device property, it should be checked that the stream is currently routed to the filter device. It seemed simpler to do it this way compared to setting up stream move monitoring in filter-apply and removing the property when the stream moves away from the filter device.
This commit is contained in:
		
							parent
							
								
									13fc833387
								
							
						
					
					
						commit
						085cced42c
					
				
					 2 changed files with 71 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -649,6 +649,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void route_sink_input(struct userdata *u, pa_sink_input *si) {
 | 
			
		||||
    const char *filter_device;
 | 
			
		||||
    const char *role;
 | 
			
		||||
    uint32_t role_index, device_index;
 | 
			
		||||
    pa_sink *sink;
 | 
			
		||||
| 
						 | 
				
			
			@ -663,6 +664,15 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) {
 | 
			
		|||
    if (!si->sink)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    /* If module-filter-apply has loaded a filter for the stream, let's not
 | 
			
		||||
     * break the filtering. The pa_streq() check is needed, because
 | 
			
		||||
     * module-filter-apply doesn't unset the property when the stream moves
 | 
			
		||||
     * away from the filter device for whatever reason (this is ugly, but
 | 
			
		||||
     * easier to do this way than appropriately unsetting the property). */
 | 
			
		||||
    filter_device = pa_proplist_gets(si->proplist, "module-filter-apply.filter_device");
 | 
			
		||||
    if (filter_device && pa_streq(filter_device, si->sink->name))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    /* It might happen that a stream and a sink are set up at the
 | 
			
		||||
    same time, in which case we want to make sure we don't
 | 
			
		||||
    interfere with that */
 | 
			
		||||
| 
						 | 
				
			
			@ -707,6 +717,7 @@ static pa_hook_result_t route_sink_inputs(struct userdata *u, pa_sink *ignore_si
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void route_source_output(struct userdata *u, pa_source_output *so) {
 | 
			
		||||
    const char *filter_device;
 | 
			
		||||
    const char *role;
 | 
			
		||||
    uint32_t role_index, device_index;
 | 
			
		||||
    pa_source *source;
 | 
			
		||||
| 
						 | 
				
			
			@ -724,6 +735,15 @@ static void route_source_output(struct userdata *u, pa_source_output *so) {
 | 
			
		|||
    if (!so->source)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    /* If module-filter-apply has loaded a filter for the stream, let's not
 | 
			
		||||
     * break the filtering. The pa_streq() check is needed, because
 | 
			
		||||
     * module-filter-apply doesn't unset the property when the stream moves
 | 
			
		||||
     * away from the filter device for whatever reason (this is ugly, but
 | 
			
		||||
     * easier to do this way than appropriately unsetting the property). */
 | 
			
		||||
    filter_device = pa_proplist_gets(so->proplist, "module-filter-apply.filter_device");
 | 
			
		||||
    if (filter_device && pa_streq(filter_device, so->source->name))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    /* It might happen that a stream and a source are set up at the
 | 
			
		||||
    same time, in which case we want to make sure we don't
 | 
			
		||||
    interfere with that */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue