impl-node: first start the node, then make it schedulable

We first need to issue the start command for driver nodes and then
we can add the node to be scheduled. Else we might end up with nodes
that receive the _process callback without the Start command being
called first and we can crash.

See #904
This commit is contained in:
Wim Taymans 2021-03-23 10:17:01 +01:00
parent 7ee52b396d
commit 4668b72312

View file

@ -338,10 +338,11 @@ static void node_update_state(struct pw_impl_node *node, enum pw_node_state stat
switch (state) {
case PW_NODE_STATE_RUNNING:
pw_loop_invoke(node->data_loop, do_node_add, 1, NULL, 0, true, node);
if (node->driving && node->driver)
spa_node_send_command(node->node,
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start));
pw_loop_invoke(node->data_loop, do_node_add, 1, NULL, 0, true, node);
break;
default:
break;