summaryrefslogtreecommitdiff
blob: 29469205cf48ad27212ea5610e6df5d80c3c9f14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/a275e825c75c93775baaeb17479e38d035d9b79a

From a275e825c75c93775baaeb17479e38d035d9b79a Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Fri, 14 Apr 2023 12:01:03 +0200
Subject: [PATCH] context: improve state calculations

Always make peers of non-passive links runnable, even if we already
visited the peer node. This makes non-passive links between drivers set the
drivers to runnable. (midi-bridge, source to sink). It also makes nodes
collected from the (link-)group runnable when they are linked together.

To calculate the runnable state of the other nodes, only start from
non-driver runnable nodes (like we already did when following links).

This makes a link from echo-cancel-source to echo-cancel-sink activate
the echo-canceler chain instead of staying idle.
--- a/src/pipewire/context.c
+++ b/src/pipewire/context.c
@@ -788,9 +788,6 @@ static inline int run_nodes(struct pw_context *context, struct pw_impl_node *nod
 	struct pw_impl_port *p;
 	struct pw_impl_link *l;
 
-	if (!node->runnable)
-		return 0;
-
 	pw_log_debug("node %p: '%s'", node, node->name);
 
 	spa_list_for_each(p, &node->input_ports, link) {
@@ -885,7 +882,7 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
 
 				pw_impl_link_prepare(l);
 
-				if (!l->prepared || (t != n && t->visited))
+				if (!l->prepared)
 					continue;
 
 				if (!l->passive)
@@ -906,7 +903,7 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
 
 				pw_impl_link_prepare(l);
 
-				if (!l->prepared || (t != n && t->visited))
+				if (!l->prepared)
 					continue;
 
 				if (!l->passive)
@@ -936,7 +933,8 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
 		pw_log_debug(" next node %p: '%s' runnable:%u", n, n->name, n->runnable);
 	}
 	spa_list_for_each(n, collect, sort_link)
-		run_nodes(context, n, collect);
+		if (!n->driver && n->runnable)
+			run_nodes(context, n, collect);
 
 	return 0;
 }
-- 
GitLab