diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c index a939166be..3e9f790f0 100644 --- a/src/modules/module-client-node/remote-node.c +++ b/src/modules/module-client-node/remote-node.c @@ -1170,19 +1170,13 @@ static const struct pw_proxy_events proxy_client_node_events = { .bound_props = client_node_bound_props, }; -static inline uint64_t get_time_ns(struct spa_system *system) -{ - struct timespec ts; - spa_system_clock_gettime(system, CLOCK_MONOTONIC, &ts); - return SPA_TIMESPEC_TO_NSEC(&ts); -} - static void context_complete(void *data, struct pw_impl_node *node) { struct node_data *d = data; struct spa_system *data_system = d->data_system; - if (node != d->node || !node->driving) + if (node != d->node || !node->driving || + !SPA_FLAG_IS_SET(node->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_PROFILER)) return; if (SPA_UNLIKELY(spa_system_eventfd_write(data_system, d->rtwritefd, 1) < 0)) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 38096cb97..3beb4f8d7 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -505,6 +505,10 @@ void pw_context_driver_add_listener(struct pw_context *context, .listener = listener, .events = events, .data = data }; + struct pw_impl_node *n; + spa_list_for_each(n, &context->driver_list, driver_link) { + SPA_FLAG_SET(n->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_PROFILER); + } pw_loop_invoke(context->data_loop, do_add_listener, SPA_ID_INVALID, &d, sizeof(d), false, context); } @@ -521,6 +525,10 @@ SPA_EXPORT void pw_context_driver_remove_listener(struct pw_context *context, struct spa_hook *listener) { + struct pw_impl_node *n; + spa_list_for_each(n, &context->driver_list, driver_link) { + SPA_FLAG_CLEAR(n->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_PROFILER); + } pw_loop_invoke(context->data_loop, do_remove_listener, SPA_ID_INVALID, NULL, 0, true, listener); } diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 265e1cb43..f1cec889d 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -635,9 +635,13 @@ struct pw_node_activation { * used when driver segment_owner has this node id */ /* for drivers, shared with all nodes */ - uint32_t segment_owner[32]; /* id of owners for each segment info struct. + 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[15]; +#define PW_NODE_ACTIVATION_FLAG_NONE 0 +#define PW_NODE_ACTIVATION_FLAG_PROFILER (1<<0) /* the profiler is running */ + uint32_t flags; /* extra flags */ struct spa_io_position position; /* contains current position and segment info. * extra info is updated by nodes that have set * themselves as owner in the segment structs */