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:
Wim Taymans 2025-03-19 17:04:38 +01:00
parent d20a1523b6
commit 3abda54d80

View file

@ -181,7 +181,7 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
nc = &dummy;
/* default value */
spa_pod_builder_primitive(b, v1);
spa_pod_builder_primitive(b, v2);
if ((p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_None) ||
(p1c == SPA_CHOICE_None && p2c == SPA_CHOICE_Enum) ||
@ -189,10 +189,10 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
(p1c == SPA_CHOICE_Enum && p2c == SPA_CHOICE_Enum)) {
int n_copied = 0;
/* 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 (k = 0, a2 = alt2; k < nalt2; k++, a2 = SPA_PTROFF(a2,size,void)) {
for (j = 0, a2 = alt2; j < nalt2; j++, 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 (p1c == SPA_CHOICE_Enum || j > 0)
if (p2c == SPA_CHOICE_Enum || j > 0)
spa_pod_builder_raw(b, a1, size);
n_copied++;
}