From e045ef0e4c7fe8356f48330f949d2c2e8abbb813 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 14 Jun 2024 12:41:03 +0200 Subject: [PATCH] impl-node: add compat with old nodes --- src/modules/module-client-node/client-node.c | 4 ++++ src/pipewire/extensions/client-node.h | 3 ++- src/pipewire/impl-node.c | 12 +++++++----- src/pipewire/private.h | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 163b48679..1b55e05d9 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -1802,6 +1802,10 @@ struct pw_impl_client_node *pw_impl_client_node_new(struct pw_resource *resource if (resource->version < 5) { pw_log_warn("using server side driver for old client version %d", resource->version); } + if (resource->version < 6) { + pw_log_warn("using server side status for old client version %d", resource->version); + this->node->server_status = true; + } pw_resource_add_listener(this->resource, &impl->resource_listener, diff --git a/src/pipewire/extensions/client-node.h b/src/pipewire/extensions/client-node.h index a7d98658e..d1c6e7338 100644 --- a/src/pipewire/extensions/client-node.h +++ b/src/pipewire/extensions/client-node.h @@ -25,8 +25,9 @@ extern "C" { /* * version 4: new port_set_mix_info event added * version 5: driver nodes are scheduled on the client + * version 6: client needs to set activation INACTIVE -> FINISHED */ -#define PW_VERSION_CLIENT_NODE 5 +#define PW_VERSION_CLIENT_NODE 6 struct pw_client_node; #define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node" diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index f41e37659..aea32b388 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -147,9 +147,10 @@ do_node_prepare(struct spa_loop *loop, bool async, uint32_t seq, pw_log_warn("%p: read failed %m", this); spa_loop_add_source(loop, &this->source); - - SPA_ATOMIC_STORE(this->rt.target.activation->status, PW_NODE_ACTIVATION_FINISHED); } + if (!this->remote || this->server_status) + SPA_ATOMIC_STORE(this->rt.target.activation->status, PW_NODE_ACTIVATION_FINISHED); + spa_list_for_each(t, &this->rt.target_list, link) activate_target(this, t); @@ -178,7 +179,7 @@ do_node_unprepare(struct spa_loop *loop, bool async, uint32_t seq, if (!this->rt.prepared) return 0; - if (!this->remote) { + if (!this->remote || this->server_status) { /* We mark ourself as finished now, this will avoid going further into the process loop * in case our fd was ready (removing ourselfs from the loop should avoid that as well). * If we were supposed to be scheduled make sure we continue the graph for the peers we @@ -186,9 +187,10 @@ do_node_unprepare(struct spa_loop *loop, bool async, uint32_t seq, old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, PW_NODE_ACTIVATION_INACTIVE); if (old_state != PW_NODE_ACTIVATION_FINISHED) trigger = get_time_ns(this->rt.target.system); - - spa_loop_remove_source(loop, &this->source); } + if (!this->remote) + spa_loop_remove_source(loop, &this->source); + spa_list_for_each(t, &this->rt.target_list, link) deactivate_target(this, t, trigger); diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 9bfd88498..7517d4e73 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -748,6 +748,7 @@ struct pw_impl_node { unsigned int sync:1; /**< the sync-groups are active */ unsigned int transport:1; /**< the transport is active */ unsigned int async:1; /**< async processing, one cycle latency */ + unsigned int server_status:1; /**< old client, do status on server */ uint32_t port_user_data_size; /**< extra size for port user data */