mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
impl-node: recalc graph when destroying a node with driver
When we destroy a node that still has another driver, recalculate the graph so that the driver has a chance to idle. This can happen when we add an inactive node to the driver and then destroy the node, like for jack clients.
This commit is contained in:
parent
034dd00813
commit
a5e37540ff
1 changed files with 12 additions and 7 deletions
|
|
@ -188,8 +188,10 @@ static int pause_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(NAME" %p: pause node state:%s pause-on-idle:%d", this,
|
pw_log_debug(NAME" %p: pause node state:%s pending:%s pause-on-idle:%d", this,
|
||||||
pw_node_state_as_string(this->info.state), impl->pause_on_idle);
|
pw_node_state_as_string(this->info.state),
|
||||||
|
pw_node_state_as_string(impl->pending),
|
||||||
|
impl->pause_on_idle);
|
||||||
|
|
||||||
if (impl->pending <= PW_NODE_STATE_IDLE)
|
if (impl->pending <= PW_NODE_STATE_IDLE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1712,7 +1714,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node)
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||||
struct pw_impl_port *port;
|
struct pw_impl_port *port;
|
||||||
struct pw_impl_node *follower;
|
struct pw_impl_node *follower;
|
||||||
bool active;
|
bool active, had_driver;
|
||||||
|
|
||||||
active = node->active;
|
active = node->active;
|
||||||
node->active = false;
|
node->active = false;
|
||||||
|
|
@ -1725,6 +1727,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node)
|
||||||
pw_impl_node_emit_destroy(node);
|
pw_impl_node_emit_destroy(node);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: driver node %p", impl, node->driver_node);
|
pw_log_debug(NAME" %p: driver node %p", impl, node->driver_node);
|
||||||
|
had_driver = node != node->driver_node;
|
||||||
|
|
||||||
/* remove ourself as a follower from the driver node */
|
/* remove ourself as a follower from the driver node */
|
||||||
spa_list_remove(&node->follower_link);
|
spa_list_remove(&node->follower_link);
|
||||||
|
|
@ -1757,8 +1760,9 @@ void pw_impl_node_destroy(struct pw_impl_node *node)
|
||||||
pw_global_destroy(node->global);
|
pw_global_destroy(node->global);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active)
|
if (active || had_driver)
|
||||||
pw_context_recalc_graph(node->context, "active node destroy");
|
pw_context_recalc_graph(node->context,
|
||||||
|
"active node destroy");
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: free", node);
|
pw_log_debug(NAME" %p: free", node);
|
||||||
pw_impl_node_emit_free(node);
|
pw_impl_node_emit_free(node);
|
||||||
|
|
@ -2064,11 +2068,12 @@ int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||||
enum pw_node_state old = impl->pending;
|
enum pw_node_state old = impl->pending;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: set state (%s) %s -> %s, active %d", node,
|
pw_log_debug(NAME" %p: set state (%s) %s -> %s, active %d pause_on_idle:%d", node,
|
||||||
pw_node_state_as_string(node->info.state),
|
pw_node_state_as_string(node->info.state),
|
||||||
pw_node_state_as_string(old),
|
pw_node_state_as_string(old),
|
||||||
pw_node_state_as_string(state),
|
pw_node_state_as_string(state),
|
||||||
node->active);
|
node->active,
|
||||||
|
impl->pause_on_idle);
|
||||||
|
|
||||||
if (old != state)
|
if (old != state)
|
||||||
pw_impl_node_emit_state_request(node, state);
|
pw_impl_node_emit_state_request(node, state);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue