impl-node: only pause pause_on_idle nodes

When we are starting a node and need to cancel it, only set the node
to the paused state when pause_on_idle is set. Use the pause_node
function to make sure everything is in the paused state.

Otherwise we would send a Pause command to the node but because it was
still added to the graph we would continue to call the process function
on it.

Fixes #2701
This commit is contained in:
Wim Taymans 2022-09-23 16:51:11 +02:00
parent 7c93c29cfd
commit 69e6db5216

View file

@ -2222,8 +2222,8 @@ int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
state < PW_NODE_STATE_RUNNING &&
impl->pending_play) {
impl->pending_play = false;
spa_node_send_command(node->node,
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Pause));
if (impl->pause_on_idle)
pause_node(node);
}
pw_work_queue_cancel(impl->work, node, impl->pending_id);
node->info.state = impl->pending_state;