From abf37dbddef96518f7e93f39d910fd4e38cc887b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Mon, 9 Mar 2026 21:21:02 +0100 Subject: [PATCH] pipewire: module-client-node: use `pw_param_info_find()` to check validity Previously when parameters were enumarated, it was checked if at least one param was known for `id`. If not, `-ENOENT` was returned to signal that this param id is not supported. This is not necessarily true, since a param id might be supported, but it might have zero params at the moment, in which case an unexpected error would be returned. Fix that by using `pw_param_info_find()` with the underlying impl object to check if the param id is actually supported. --- src/modules/module-client-node/client-node.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 0253591cf..107d7363e 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -330,11 +330,13 @@ static int impl_node_enum_params(void *object, int seq, struct spa_pod_dynamic_builder b; struct spa_result_node_params result; uint32_t count = 0; - bool found = false; spa_return_val_if_fail(impl != NULL, -EINVAL); spa_return_val_if_fail(num != 0, -EINVAL); + if (!pw_param_info_find(impl->this.node->info.params, impl->this.node->info.n_params, id)) + return -ENOENT; + result.id = id; result.next = 0; @@ -350,8 +352,6 @@ static int impl_node_enum_params(void *object, int seq, if (param == NULL || !spa_pod_is_object_id(param, id)) continue; - found = true; - if (result.index < start) continue; @@ -366,7 +366,8 @@ static int impl_node_enum_params(void *object, int seq, if (count == num) break; } - return found ? 0 : -ENOENT; + + return 0; } static int impl_node_set_param(void *object, uint32_t id, uint32_t flags, @@ -598,7 +599,6 @@ node_port_enum_params(struct impl *impl, int seq, struct spa_pod_dynamic_builder b; struct spa_result_node_params result; uint32_t count = 0; - bool found = false; spa_return_val_if_fail(impl != NULL, -EINVAL); spa_return_val_if_fail(num != 0, -EINVAL); @@ -609,6 +609,9 @@ node_port_enum_params(struct impl *impl, int seq, pw_log_debug("%p: seq:%d port %d.%d id:%u start:%u num:%u n_params:%d", impl, seq, direction, port_id, id, start, num, port->params.n_params); + if (!pw_param_info_find(port->port->info.params, port->port->info.n_params, id)) + return -ENOENT; + result.id = id; result.next = 0; @@ -624,8 +627,6 @@ node_port_enum_params(struct impl *impl, int seq, if (param == NULL || !spa_pod_is_object_id(param, id)) continue; - found = true; - if (result.index < start) continue; @@ -640,7 +641,8 @@ node_port_enum_params(struct impl *impl, int seq, if (count == num) break; } - return found ? 0 : -ENOENT; + + return 0; } static int