impl-node: add id and name to pw_node_target

Make a copy of the node name into a statically allocated array. This is
for debugging purposes only but might crash if we do a name change while
the data thread is reading it.

Make it possible to do reposition on the client side by copying the id
to the target. The client side does not have a node in the target so we
can't deref it.
This commit is contained in:
Wim Taymans 2023-05-24 13:50:38 +02:00
parent 4843928370
commit 894eeae03c
5 changed files with 53 additions and 47 deletions

View file

@ -168,6 +168,7 @@ static void context_do_profile(void *data, struct pw_impl_node *node)
struct impl *impl = data;
struct spa_pod_builder b;
struct spa_pod_frame f[2];
uint32_t id = node->info.id;
struct pw_node_activation *a = node->rt.target.activation;
struct spa_io_position *pos = &a->position;
struct pw_node_target *t;
@ -205,7 +206,7 @@ static void context_do_profile(void *data, struct pw_impl_node *node)
spa_pod_builder_prop(&b, SPA_PROFILER_driverBlock, 0);
spa_pod_builder_add_struct(&b,
SPA_POD_Int(node->info.id),
SPA_POD_Int(id),
SPA_POD_String(node->name),
SPA_POD_Long(a->prev_signal_time),
SPA_POD_Long(a->signal_time),
@ -219,22 +220,26 @@ static void context_do_profile(void *data, struct pw_impl_node *node)
struct pw_node_activation *na;
struct spa_fraction latency;
if (n == NULL || n == node)
if (t->id == id)
continue;
latency = n->latency;
if (n->force_quantum != 0)
latency.num = n->force_quantum;
if (n->force_rate != 0)
latency.denom = n->force_rate;
else if (n->rate.denom != 0)
latency.denom = n->rate.denom;
if (n != NULL) {
latency = n->latency;
if (n->force_quantum != 0)
latency.num = n->force_quantum;
if (n->force_rate != 0)
latency.denom = n->force_rate;
else if (n->rate.denom != 0)
latency.denom = n->rate.denom;
} else {
spa_zero(latency);
}
na = n->rt.target.activation;
na = t->activation;
spa_pod_builder_prop(&b, SPA_PROFILER_followerBlock, 0);
spa_pod_builder_add_struct(&b,
SPA_POD_Int(n->info.id),
SPA_POD_String(n->name),
SPA_POD_Int(t->id),
SPA_POD_String(t->name),
SPA_POD_Long(a->signal_time),
SPA_POD_Long(na->signal_time),
SPA_POD_Long(na->awake_time),