client-node: let all events go to the node

Just pass all events to the node and only error out when they return an
error value.

Make sure we pass the result values of the command around.
This commit is contained in:
Wim Taymans 2025-05-20 11:47:10 +02:00
parent 12f8ca664b
commit f7eab4172e
2 changed files with 13 additions and 11 deletions

View file

@ -481,15 +481,16 @@ static int client_node_command(void *_data, const struct spa_command *command)
pw_proxy_error(proxy, res, "suspend failed");
}
break;
case SPA_NODE_COMMAND_RequestProcess:
res = pw_impl_node_send_command(node, command);
break;
default:
pw_log_warn("unhandled node command %d (%s)", id,
spa_debug_type_find_name(spa_type_node_command_id, id));
res = -ENOTSUP;
pw_proxy_errorf(proxy, res, "command %d (%s) not supported", id,
spa_debug_type_find_name(spa_type_node_command_id, id));
res = pw_impl_node_send_command(node, command);
if (res < 0) {
pw_log_warn("node command %d (%s) error: %s (%d)", id,
spa_debug_type_find_name(spa_type_node_command_id, id),
spa_strerror(res), res);
pw_proxy_errorf(proxy, res, "command %d (%s) error: %s (%d)", id,
spa_debug_type_find_name(spa_type_node_command_id, id),
spa_strerror(res), res);
}
}
return res;
}

View file

@ -660,19 +660,20 @@ static int node_send_command(void *object, const struct spa_command *command)
struct resource_data *data = object;
struct pw_impl_node *node = data->node;
uint32_t id = SPA_NODE_COMMAND_ID(command);
int res;
pw_log_debug("%p: got command %d (%s)", node, id,
spa_debug_type_find_name(spa_type_node_command_id, id));
switch (id) {
case SPA_NODE_COMMAND_Suspend:
suspend_node(node);
res = suspend_node(node);
break;
default:
spa_node_send_command(node->node, command);
res = spa_node_send_command(node->node, command);
break;
}
return 0;
return res;
}
static const struct pw_node_methods node_methods = {