mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink/source: When picking the initial ports, prefer ones that are not unavailable.
This does for sinks/source ports what f434087e42 did for card profiles.
			
			
This commit is contained in:
		
							parent
							
								
									84af39f289
								
							
						
					
					
						commit
						303cff04eb
					
				
					 2 changed files with 21 additions and 2 deletions
				
			
		| 
						 | 
					@ -304,10 +304,19 @@ pa_sink* pa_sink_new(
 | 
				
			||||||
        void *state;
 | 
					        void *state;
 | 
				
			||||||
        pa_device_port *p;
 | 
					        pa_device_port *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        PA_HASHMAP_FOREACH(p, s->ports, state) {
 | 
				
			||||||
 | 
					            if (p->available == PA_AVAILABLE_NO)
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!s->active_port || p->priority > s->active_port->priority)
 | 
				
			||||||
 | 
					                s->active_port = p;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!s->active_port) {
 | 
				
			||||||
            PA_HASHMAP_FOREACH(p, s->ports, state)
 | 
					            PA_HASHMAP_FOREACH(p, s->ports, state)
 | 
				
			||||||
                if (!s->active_port || p->priority > s->active_port->priority)
 | 
					                if (!s->active_port || p->priority > s->active_port->priority)
 | 
				
			||||||
                    s->active_port = p;
 | 
					                    s->active_port = p;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (s->active_port)
 | 
					    if (s->active_port)
 | 
				
			||||||
        s->latency_offset = s->active_port->latency_offset;
 | 
					        s->latency_offset = s->active_port->latency_offset;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -292,10 +292,20 @@ pa_source* pa_source_new(
 | 
				
			||||||
        void *state;
 | 
					        void *state;
 | 
				
			||||||
        pa_device_port *p;
 | 
					        pa_device_port *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        PA_HASHMAP_FOREACH(p, s->ports, state) {
 | 
				
			||||||
 | 
					            if (p->available == PA_AVAILABLE_NO)
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!s->active_port || p->priority > s->active_port->priority)
 | 
				
			||||||
 | 
					                s->active_port = p;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!s->active_port) {
 | 
				
			||||||
            PA_HASHMAP_FOREACH(p, s->ports, state)
 | 
					            PA_HASHMAP_FOREACH(p, s->ports, state)
 | 
				
			||||||
                if (!s->active_port || p->priority > s->active_port->priority)
 | 
					                if (!s->active_port || p->priority > s->active_port->priority)
 | 
				
			||||||
                    s->active_port = p;
 | 
					                    s->active_port = p;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (s->active_port)
 | 
					    if (s->active_port)
 | 
				
			||||||
        s->latency_offset = s->active_port->latency_offset;
 | 
					        s->latency_offset = s->active_port->latency_offset;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue