node: set clock id and position

This commit is contained in:
Wim Taymans 2018-11-12 09:53:49 +01:00
parent e03289b4ac
commit 3d3d86fd24

View file

@ -446,6 +446,7 @@ int pw_node_register(struct pw_node *this,
struct pw_global *parent, struct pw_global *parent,
struct pw_properties *properties) struct pw_properties *properties)
{ {
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
struct pw_core *core = this->core; struct pw_core *core = this->core;
const char *str; const char *str;
@ -478,6 +479,7 @@ int pw_node_register(struct pw_node *this,
return -ENOMEM; return -ENOMEM;
this->info.id = this->global->id; this->info.id = this->global->id;
impl->position.clock.id = this->info.id;
pw_properties_setf(this->properties, "node.id", "%d", this->info.id); pw_properties_setf(this->properties, "node.id", "%d", this->info.id);
pw_node_initialized(this); pw_node_initialized(this);
@ -512,6 +514,13 @@ do_move_nodes(struct spa_loop *loop,
spa_graph_node_remove(&this->rt.root); spa_graph_node_remove(&this->rt.root);
spa_graph_node_add(&dst->driver_graph, &this->rt.root); spa_graph_node_add(&dst->driver_graph, &this->rt.root);
if (spa_node_set_io(this->node,
SPA_IO_Position,
&dst->position, sizeof(struct spa_io_position)) >= 0) {
pw_log_debug("node %p: set position %p", this, &dst->position);
this->rt.position = &dst->position;
}
if (&src->driver_graph == &dst->driver_graph) if (&src->driver_graph == &dst->driver_graph)
return 0; return 0;