mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pod: use default value of filter
When using a filter, it makes more sense to use the default value of the filter as a first attempt. One case is in adapter when we try to find a passthrough format first. The audioconverter suggests a default rate of the graph rate but the follower filters this out for another unrelated default value and passthrough is not possible (altough it would be because the default value of the filter is in the supported follower range). Fixes #4619
This commit is contained in:
		
							parent
							
								
									a460842769
								
							
						
					
					
						commit
						6f8a814f29
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -177,7 +177,7 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
 | 
				
			||||||
	nc = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f);
 | 
						nc = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* default value */
 | 
						/* default value */
 | 
				
			||||||
	spa_pod_builder_primitive(b, v1);
 | 
						spa_pod_builder_primitive(b, v2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_None) ||
 | 
						if ((p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_None) ||
 | 
				
			||||||
	    (p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_Enum) ||
 | 
						    (p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_Enum) ||
 | 
				
			||||||
| 
						 | 
					@ -185,10 +185,10 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
 | 
				
			||||||
	    (p1c == SPA_CHOICE_Enum && p2c == SPA_CHOICE_Enum)) {
 | 
						    (p1c == SPA_CHOICE_Enum && p2c == SPA_CHOICE_Enum)) {
 | 
				
			||||||
		int n_copied = 0;
 | 
							int n_copied = 0;
 | 
				
			||||||
		/* copy all equal values but don't copy the default value again */
 | 
							/* copy all equal values but don't copy the default value again */
 | 
				
			||||||
		for (j = 0, a1 = alt1; j < nalt1; j++, a1 = SPA_PTROFF(a1, size, void)) {
 | 
							for (j = 0, a2 = alt2; j < nalt2; j++, a2 = SPA_PTROFF(a2, size, void)) {
 | 
				
			||||||
			for (k = 0, a2 = alt2; k < nalt2; k++, a2 = SPA_PTROFF(a2,size,void)) {
 | 
								for (k = 0, a1 = alt1; k < nalt1; k++, a1 = SPA_PTROFF(a1,size,void)) {
 | 
				
			||||||
				if (spa_pod_compare_value(type, a1, a2, size) == 0) {
 | 
									if (spa_pod_compare_value(type, a1, a2, size) == 0) {
 | 
				
			||||||
					if (p1c == SPA_CHOICE_Enum || j > 0)
 | 
										if (p2c == SPA_CHOICE_Enum || j > 0)
 | 
				
			||||||
						spa_pod_builder_raw(b, a1, size);
 | 
											spa_pod_builder_raw(b, a1, size);
 | 
				
			||||||
					n_copied++;
 | 
										n_copied++;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue