impl: don't return -ENOENT when no params

We checked above if the param is supported and return -ENOENT already.

When we actually go enumerate the params but don't have any, return 0
and not an error.

Fixes wireplumber#370
This commit is contained in:
Wim Taymans 2022-11-07 12:36:15 +01:00
parent 332fc0d9a5
commit 02add5b3db
3 changed files with 3 additions and 12 deletions

View file

@ -328,7 +328,6 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
struct spa_pod_dynamic_builder b;
struct spa_result_device_params result;
uint32_t count = 0;
bool found = false;
result.id = param_id;
result.next = 0;
@ -337,8 +336,6 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
if (p->id != param_id)
continue;
found = true;
result.index = result.next++;
if (result.index < index)
continue;
@ -354,7 +351,7 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
if (count == max)
break;
}
res = found ? 0 : -ENOENT;
res = 0;
} else {
user_data.cache = impl->cache_params &&
(filter == NULL && index == 0 && max == UINT32_MAX);

View file

@ -2015,7 +2015,6 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
struct spa_pod_dynamic_builder b;
struct spa_result_node_params result;
uint32_t count = 0;
bool found = false;
result.id = param_id;
result.next = 0;
@ -2024,8 +2023,6 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
if (p->id != param_id)
continue;
found = true;
result.index = result.next++;
if (result.index < index)
continue;
@ -2042,7 +2039,7 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
if (count == max)
break;
}
res = found ? 0 : -ENOENT;
res = 0;
} else {
user_data.cache = impl->cache_params &&
(filter == NULL && index == 0 && max == UINT32_MAX);

View file

@ -1248,7 +1248,6 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
struct spa_pod_dynamic_builder b;
struct spa_result_node_params result;
uint32_t count = 0;
bool found = false;
result.id = param_id;
result.next = 0;
@ -1257,8 +1256,6 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
if (p->id != param_id)
continue;
found = true;
result.index = result.next++;
if (result.index < index)
continue;
@ -1275,7 +1272,7 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
if (count == max)
break;
}
res = found ? 0 : -ENOENT;
res = 0;
} else {
user_data.cache = impl->cache_params &&
(filter == NULL && index == 0 && max == UINT32_MAX);