mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-20 00:11:31 +00:00
impl-link: prepare link only between active nodes
We only ever want to prepare a link between active nodes so add the check in the _prepare() functions instead. This also makes it skip the prepare step for inactive nodes when recalculating the graph.
This commit is contained in:
parent
2dabd337dc
commit
158c23b2fd
|
@ -673,7 +673,12 @@ int pw_impl_link_prepare(struct pw_impl_link *this)
|
|||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
|
||||
pw_log_debug(NAME" %p: prepare prepared:%d busy:%d", this, this->prepared, this->preparing);
|
||||
pw_log_debug(NAME" %p: prepare prepared:%d busy:%d in_active:%d out_active:%d",
|
||||
this, this->prepared, this->preparing,
|
||||
impl->inode->active, impl->onode->active);
|
||||
|
||||
if (!impl->inode->active || !impl->onode->active)
|
||||
return 0;
|
||||
|
||||
if (this->preparing || this->prepared)
|
||||
return 0;
|
||||
|
@ -903,19 +908,10 @@ static void output_node_result(void *data, int seq, int res, uint32_t type, cons
|
|||
node_result(impl, port, seq, res, type, result);
|
||||
}
|
||||
|
||||
static void check_prepare(struct pw_impl_link *this)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
pw_log_debug(NAME" %p: input active:%d output active:%d", impl,
|
||||
impl->inode->active, impl->onode->active);
|
||||
if (impl->inode->active && impl->onode->active)
|
||||
pw_impl_link_prepare(this);
|
||||
}
|
||||
|
||||
static void node_active_changed(void *data, bool active)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
check_prepare(&impl->this);
|
||||
pw_impl_link_prepare(&impl->this);
|
||||
}
|
||||
|
||||
static const struct pw_impl_node_events input_node_events = {
|
||||
|
@ -1287,7 +1283,7 @@ int pw_impl_link_register(struct pw_impl_link *link,
|
|||
pw_global_add_listener(link->global, &link->global_listener, &global_events, link);
|
||||
pw_global_register(link->global);
|
||||
|
||||
check_prepare(link);
|
||||
pw_impl_link_prepare(link);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue