From 33f1a713cdb6e5c40499189c4c21e83be1952730 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 18 Jun 2024 09:47:33 +0200 Subject: [PATCH] impl-node: set active_driver_id This is the driver id that the client has received and is using right now. We don't use this yet but it could be used in the future to check if a client has the most up to date info. --- pipewire-jack/src/pipewire-jack.c | 1 + src/pipewire/impl-node.c | 3 +++ src/pipewire/private.h | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 68763384e..c5121b860 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -2239,6 +2239,7 @@ static int client_node_set_io(void *data, c->position = ptr; c->driver_id = ptr ? c->position->clock.id : SPA_ID_INVALID; update_driver_activation(c); + c->activation->active_driver_id = c->driver_id; queue_memmap_free(c, old); old = NULL; break; diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index f5fb170b9..68daebaef 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -767,6 +767,9 @@ int pw_impl_node_set_io(struct pw_impl_node *this, uint32_t id, void *data, size res = spa_node_set_io(this->node, id, data, size); + if (res >= 0 && !SPA_RESULT_IS_ASYNC(res) && this->rt.position) + this->rt.target.activation->active_driver_id = this->rt.position->clock.id; + pw_log_debug("%p: set io: %s", this, spa_strerror(res)); return res; diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 8c4903907..8c01fe8d5 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -606,11 +606,11 @@ struct pw_node_activation { uint32_t segment_owner[16]; /* id of owners for each segment info struct. * nodes that want to update segment info need to * CAS their node id in this array. */ - uint32_t padding[11]; - uint32_t client_version; - uint32_t server_version; + uint32_t padding[11]; /* must be 0 */ + uint32_t client_version; /* verions of client, see above */ + uint32_t server_version; /* verions of server, see above */ - uint32_t active_driver_id; + uint32_t active_driver_id; /* driver active on client */ uint32_t driver_id; /* the current node driver id */ #define PW_NODE_ACTIVATION_FLAG_NONE 0 #define PW_NODE_ACTIVATION_FLAG_PROFILER (1<<0) /* the profiler is running */