mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
impl-node: make exported nodes complete state change sync
Don't queue an async state change completion for exported nodes. The server sends a ping to check for completion and we want this ping reply to happen after the state completion. Consider the case where we have a follower and a driver, the follower is sent the Start/Ping commands and replies to the ping but is still processing the state change async. The server can then Start the driver, which will then try to schedule the (still starting) follower and fail. We could add the ping to the work queue as well but that creates complications because modules (clients) and server share the same work queues right now and block each other completions. We could also make a method to process the work queue immediately but that would be dangerous as well because it could contain a BUSY item from some module that would block things.
This commit is contained in:
parent
9f7c481742
commit
800a25a01f
1 changed files with 11 additions and 3 deletions
|
|
@ -2780,9 +2780,17 @@ int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
|
||||||
* will wait until all previous items in the work queue are
|
* will wait until all previous items in the work queue are
|
||||||
* completed */
|
* completed */
|
||||||
impl->pending_state = state;
|
impl->pending_state = state;
|
||||||
impl->pending_id = pw_work_queue_add(impl->work,
|
if (node->exported) {
|
||||||
node, res == EBUSY ? -EBUSY : res,
|
/* exported nodes must complete immediately. This is important
|
||||||
on_state_complete, SPA_INT_TO_PTR(state));
|
* because the server sends ping to check completion. The server
|
||||||
|
* will only send Start to driver nodes when all clients are
|
||||||
|
* ready for processing. */
|
||||||
|
on_state_complete(node, SPA_INT_TO_PTR(state), -EBUSY, 0);
|
||||||
|
} else {
|
||||||
|
impl->pending_id = pw_work_queue_add(impl->work,
|
||||||
|
node, res == EBUSY ? -EBUSY : res,
|
||||||
|
on_state_complete, SPA_INT_TO_PTR(state));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue