[pulseaudio-discuss] [PATCH 22/23] node: Notify pa_router about new and removed nodes

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Wed Nov 20 01:26:14 PST 2013


---
 src/pulsecore/node.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/node.c b/src/pulsecore/node.c
index 7b4d61f..02b3f84 100644
--- a/src/pulsecore/node.c
+++ b/src/pulsecore/node.c
@@ -26,6 +26,7 @@
 
 #include <pulsecore/core-util.h>
 #include <pulsecore/namereg.h>
+#include <pulsecore/router.h>
 #include <pulsecore/strbuf.h>
 
 #include "node.h"
@@ -157,9 +158,11 @@ void pa_node_put(pa_node *node) {
     pa_assert(node->owner);
 
     pa_assert_se(pa_idxset_put(node->core->nodes, node, &node->index) >= 0);
-
     node->state = PA_NODE_STATE_LINKED;
 
+    if (node->core->router)
+        pa_router_add_node(node->core->router, node);
+
     pa_log_debug("Created node %s.", node->name);
 }
 
@@ -171,8 +174,10 @@ void pa_node_unlink(pa_node *node) {
         return;
 
     pa_log_debug("Unlinking node %s.", node->name);
+    node->state = PA_NODE_STATE_UNLINKED;
 
-    pa_assert_se(pa_idxset_remove_by_index(node->core->nodes, node->index));
+    if (node->core->router)
+        pa_router_remove_node(node->core->router, node);
 
-    node->state = PA_NODE_STATE_UNLINKED;
+    pa_assert_se(pa_idxset_remove_by_index(node->core->nodes, node->index));
 }
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list