mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-17 07:00:03 -05:00
impl-node: refactor pause_node
Rename pause_node to idle_node and only perform the pause when pause_on_idle is active.
This commit is contained in:
parent
69e6db5216
commit
6fda8212e7
1 changed files with 7 additions and 6 deletions
|
|
@ -188,12 +188,12 @@ static void node_deactivate(struct pw_impl_node *this)
|
||||||
pw_loop_invoke(this->data_loop, do_node_remove, 1, NULL, 0, true, this);
|
pw_loop_invoke(this->data_loop, do_node_remove, 1, NULL, 0, true, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pause_node(struct pw_impl_node *this)
|
static int idle_node(struct pw_impl_node *this)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
pw_log_debug("%p: pause node state:%s pending:%s pause-on-idle:%d", this,
|
pw_log_debug("%p: idle node state:%s pending:%s pause-on-idle:%d", this,
|
||||||
pw_node_state_as_string(this->info.state),
|
pw_node_state_as_string(this->info.state),
|
||||||
pw_node_state_as_string(impl->pending_state),
|
pw_node_state_as_string(impl->pending_state),
|
||||||
impl->pause_on_idle);
|
impl->pause_on_idle);
|
||||||
|
|
@ -201,6 +201,9 @@ static int pause_node(struct pw_impl_node *this)
|
||||||
if (impl->pending_state <= PW_NODE_STATE_IDLE)
|
if (impl->pending_state <= PW_NODE_STATE_IDLE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!impl->pause_on_idle)
|
||||||
|
return 0;
|
||||||
|
|
||||||
node_deactivate(this);
|
node_deactivate(this);
|
||||||
|
|
||||||
res = spa_node_send_command(this->node,
|
res = spa_node_send_command(this->node,
|
||||||
|
|
@ -2192,8 +2195,7 @@ int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PW_NODE_STATE_IDLE:
|
case PW_NODE_STATE_IDLE:
|
||||||
if (impl->pause_on_idle)
|
res = idle_node(node);
|
||||||
res = pause_node(node);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PW_NODE_STATE_RUNNING:
|
case PW_NODE_STATE_RUNNING:
|
||||||
|
|
@ -2222,8 +2224,7 @@ int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
|
||||||
state < PW_NODE_STATE_RUNNING &&
|
state < PW_NODE_STATE_RUNNING &&
|
||||||
impl->pending_play) {
|
impl->pending_play) {
|
||||||
impl->pending_play = false;
|
impl->pending_play = false;
|
||||||
if (impl->pause_on_idle)
|
idle_node(node);
|
||||||
pause_node(node);
|
|
||||||
}
|
}
|
||||||
pw_work_queue_cancel(impl->work, node, impl->pending_id);
|
pw_work_queue_cancel(impl->work, node, impl->pending_id);
|
||||||
node->info.state = impl->pending_state;
|
node->info.state = impl->pending_state;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue