mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-13 05:33:55 -04:00
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.
This commit is contained in:
parent
5e37d43881
commit
abf37dbdde
1 changed files with 10 additions and 8 deletions
|
|
@ -330,11 +330,13 @@ static int impl_node_enum_params(void *object, int seq,
|
||||||
struct spa_pod_dynamic_builder b;
|
struct spa_pod_dynamic_builder b;
|
||||||
struct spa_result_node_params result;
|
struct spa_result_node_params result;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(impl != NULL, -EINVAL);
|
spa_return_val_if_fail(impl != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(num != 0, -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.id = id;
|
||||||
result.next = 0;
|
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))
|
if (param == NULL || !spa_pod_is_object_id(param, id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
found = true;
|
|
||||||
|
|
||||||
if (result.index < start)
|
if (result.index < start)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -366,7 +366,8 @@ static int impl_node_enum_params(void *object, int seq,
|
||||||
if (count == num)
|
if (count == num)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return found ? 0 : -ENOENT;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
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_pod_dynamic_builder b;
|
||||||
struct spa_result_node_params result;
|
struct spa_result_node_params result;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(impl != NULL, -EINVAL);
|
spa_return_val_if_fail(impl != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(num != 0, -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",
|
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);
|
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.id = id;
|
||||||
result.next = 0;
|
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))
|
if (param == NULL || !spa_pod_is_object_id(param, id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
found = true;
|
|
||||||
|
|
||||||
if (result.index < start)
|
if (result.index < start)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -640,7 +641,8 @@ node_port_enum_params(struct impl *impl, int seq,
|
||||||
if (count == num)
|
if (count == num)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return found ? 0 : -ENOENT;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue