mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pod: swap inputs for filter when invalid default
We usualy want to prefer the filter default value. When this value is not within the valid range/alternatives, swap the logic and prefer the defaults of the other pod. This way we can have a filter with an invalid default that will then use the preference of the other pod but still enforce some bounds.
This commit is contained in:
		
							parent
							
								
									8b01fce2bc
								
							
						
					
					
						commit
						abfad78fb3
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -94,11 +94,18 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
 | 
			
		|||
	if (nc == NULL)
 | 
			
		||||
		nc = &dummy;
 | 
			
		||||
 | 
			
		||||
	/* we should prefer alt2 values but only if they are within the
 | 
			
		||||
	 * range, start with an empty child and we will select a good default
 | 
			
		||||
	/* start with an empty child and we will select a good default
 | 
			
		||||
	 * below */
 | 
			
		||||
	spa_pod_builder_child(b, size, type);
 | 
			
		||||
 | 
			
		||||
	/* we should prefer alt2 values but only if they are within the
 | 
			
		||||
	 * range. Swap the order otherwise. */
 | 
			
		||||
	if (!spa_pod_compare_is_valid_choice(type, size, alt2, alt2, nalt2, p2c)) {
 | 
			
		||||
		SPA_SWAP(alt2, alt1);
 | 
			
		||||
		SPA_SWAP(nalt2, nalt1);
 | 
			
		||||
		SPA_SWAP(p2c, p1c);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_None) ||
 | 
			
		||||
	    (p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_Enum) ||
 | 
			
		||||
	    (p1c == SPA_CHOICE_Enum && p2c == SPA_CHOICE_None) ||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue