From 2a3f92e67fcc7f20e435a1c6eca145c3e10bfaba Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 20 May 2025 11:47:10 +0200 Subject: [PATCH] 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. --- src/modules/module-client-node/remote-node.c | 17 +++++++++-------- src/pipewire/impl-node.c | 7 ++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c index 8b5c7daf3..52134eaa4 100644 --- a/src/modules/module-client-node/remote-node.c +++ b/src/modules/module-client-node/remote-node.c @@ -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; } diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 351f98b06..e5636d561 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -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 = {