impl-node: delay starting the driver node

Only start the driver node after we have added ourselves to the
driver node or else we might start too soon, before there is anything
to schedule and we cause driver underruns.
This commit is contained in:
Wim Taymans 2021-03-10 13:28:56 +01:00
parent 62def0399f
commit 78e9e5958e

View file

@ -214,8 +214,9 @@ static int start_node(struct pw_impl_node *this)
pw_log_debug(NAME" %p: start node", this); pw_log_debug(NAME" %p: start node", this);
res = spa_node_send_command(this->node, if (!this->driving)
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start)); res = spa_node_send_command(this->node,
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start));
if (res < 0) if (res < 0)
pw_log_error("(%s-%u) start node error %d: %s", this->name, this->info.id, pw_log_error("(%s-%u) start node error %d: %s", this->name, this->info.id,
@ -338,6 +339,9 @@ static void node_update_state(struct pw_impl_node *node, enum pw_node_state stat
switch (state) { switch (state) {
case PW_NODE_STATE_RUNNING: case PW_NODE_STATE_RUNNING:
pw_loop_invoke(node->data_loop, do_node_add, 1, NULL, 0, true, node); pw_loop_invoke(node->data_loop, do_node_add, 1, NULL, 0, true, node);
if (node->driving)
spa_node_send_command(node->node,
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start));
break; break;
default: default:
break; break;