From 5303fced5082c472ae8c0dd0ca6b0243db16681e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 26 Apr 2023 15:56:29 +0200 Subject: [PATCH] client-node: pass the ready status in the activation state Pass the ready status to the client-node using the state array. Don't just SPA_STATUS_HAVE_DATA on the server side but use the value from the client. This avoids some potential extra work when a driver sink pulls in data with the NEED_DATA ready callback but then the server performs the actions (tee) as if it were SPA_STATUS_HAVE_DATA. --- src/modules/module-client-node/client-node.c | 7 +++++-- src/modules/module-client-node/remote-node.c | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index cd86d1bd2..d22a8a1d9 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -1105,6 +1105,8 @@ static void node_on_data_fd_events(struct spa_source *source) if (source->rmask & SPA_IO_IN) { uint64_t cmd; struct pw_impl_node *node = this->impl->this.node; + struct pw_node_activation *a = node->rt.activation; + int status; if (SPA_UNLIKELY(spa_system_eventfd_read(this->data_system, this->data_source.fd, &cmd) < 0)) @@ -1113,8 +1115,9 @@ static void node_on_data_fd_events(struct spa_source *source) pw_log_info("(%s-%u) client missed %"PRIu64" wakeups", node->name, node->info.id, cmd - 1); - spa_log_trace_fp(this->log, "%p: got ready", this); - spa_node_call_ready(&this->callbacks, SPA_STATUS_HAVE_DATA); + status = a->state[0].status; + spa_log_trace_fp(this->log, "%p: got ready %d", this, status); + spa_node_call_ready(&this->callbacks, status); } } diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c index 8e7a88b62..55b4c2d55 100644 --- a/src/modules/module-client-node/remote-node.c +++ b/src/modules/module-client-node/remote-node.c @@ -1189,8 +1189,9 @@ static int node_ready(void *d, int status) spa_node_process(p->mix); } - spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts); + a->state[0].status = status; a->status = PW_NODE_ACTIVATION_TRIGGERED; + spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts); a->signal_time = SPA_TIMESPEC_TO_NSEC(&ts); if (SPA_UNLIKELY(spa_system_eventfd_write(data_system, data->rtwritefd, 1) < 0))