mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
impl-node: improve set_io some more
Make sure we first set up our own state before calling into the implementation. That way, the implementation can look at the new state.
This commit is contained in:
parent
a683049986
commit
06905cd53b
1 changed files with 18 additions and 8 deletions
|
|
@ -715,8 +715,10 @@ do_update_position(struct spa_loop *loop,
|
||||||
void *position = *(void**)data;
|
void *position = *(void**)data;
|
||||||
pw_log_trace("%p: set position %p", node, position);
|
pw_log_trace("%p: set position %p", node, position);
|
||||||
node->rt.position = position;
|
node->rt.position = position;
|
||||||
node->target_rate = node->rt.position->clock.target_rate;
|
if (position) {
|
||||||
node->target_quantum = node->rt.position->clock.target_duration;
|
node->target_rate = node->rt.position->clock.target_rate;
|
||||||
|
node->target_quantum = node->rt.position->clock.target_duration;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -726,19 +728,23 @@ int pw_impl_node_set_io(struct pw_impl_node *this, uint32_t id, void *data, size
|
||||||
int res;
|
int res;
|
||||||
struct pw_impl_port *port;
|
struct pw_impl_port *port;
|
||||||
|
|
||||||
res = spa_node_set_io(this->node, id, data, size);
|
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SPA_IO_Position:
|
case SPA_IO_Position:
|
||||||
pw_log_debug("%p: set position %p: %s", this, data, spa_strerror(res));
|
if (data != NULL && size < sizeof(struct spa_io_position))
|
||||||
|
return -EINVAL;
|
||||||
|
pw_log_debug("%p: set position %p", this, data);
|
||||||
pw_loop_invoke(this->data_loop,
|
pw_loop_invoke(this->data_loop,
|
||||||
do_update_position, SPA_ID_INVALID, &data, sizeof(void*), true, this);
|
do_update_position, SPA_ID_INVALID, &data, sizeof(void*), true, this);
|
||||||
break;
|
break;
|
||||||
case SPA_IO_Clock:
|
case SPA_IO_Clock:
|
||||||
pw_log_debug("%p: set clock %p: %s", this, data, spa_strerror(res));
|
if (data != NULL && size < sizeof(struct spa_io_clock))
|
||||||
|
return -EINVAL;
|
||||||
|
pw_log_debug("%p: set clock %p", this, data);
|
||||||
this->rt.clock = data;
|
this->rt.clock = data;
|
||||||
this->info.id = this->rt.clock->id;
|
if (this->rt.clock) {
|
||||||
this->rt.target.id = this->info.id;
|
this->info.id = this->rt.clock->id;
|
||||||
|
this->rt.target.id = this->info.id;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->driving = this->driver && this->rt.clock && this->rt.position &&
|
this->driving = this->driver && this->rt.clock && this->rt.position &&
|
||||||
|
|
@ -753,6 +759,10 @@ int pw_impl_node_set_io(struct pw_impl_node *this, uint32_t id, void *data, size
|
||||||
spa_list_for_each(port, &this->output_ports, link)
|
spa_list_for_each(port, &this->output_ports, link)
|
||||||
spa_node_set_io(port->mix, id, data, size);
|
spa_node_set_io(port->mix, id, data, size);
|
||||||
|
|
||||||
|
res = spa_node_set_io(this->node, id, data, size);
|
||||||
|
|
||||||
|
pw_log_debug("%p: set io: %s", this, spa_strerror(res));
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue