[pulseaudio-discuss] [PATCH v2 05/21] sink: Create the sink node before creating the monitor source

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Dec 5 06:19:05 PST 2013


The sink node object will be used during the monitor source creation
to figure out whether the monitor source should create a node for
itself.
---
 src/pulsecore/sink.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 746ace1..1783c95 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -342,6 +342,18 @@ pa_sink* pa_sink_new(
     if (s->card)
         pa_assert_se(pa_idxset_put(s->card->sinks, s, NULL) >= 0);
 
+    if (pa_hashmap_isempty(s->ports)) {
+        if (!data->node_data.description)
+            pa_node_new_data_set_description(&data->node_data, pa_sink_get_description(s));
+
+        if (!(s->node = pa_node_new(s->core, &data->node_data))) {
+            pa_log("Failed to create a node for sink %s.", s->name);
+            goto fail;
+        }
+
+        s->node->owner = s;
+    }
+
     pa_source_new_data_init(&source_data);
     pa_source_new_data_set_sample_spec(&source_data, &s->sample_spec);
     pa_source_new_data_set_channel_map(&source_data, &s->channel_map);
@@ -371,18 +383,6 @@ pa_sink* pa_sink_new(
     pa_source_set_fixed_latency(s->monitor_source, s->thread_info.fixed_latency);
     pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);
 
-    if (pa_hashmap_isempty(s->ports)) {
-        if (!data->node_data.description)
-            pa_node_new_data_set_description(&data->node_data, pa_sink_get_description(s));
-
-        if (!(s->node = pa_node_new(s->core, &data->node_data))) {
-            pa_log("Failed to create a node for sink %s.", s->name);
-            goto fail;
-        }
-
-        s->node->owner = s;
-    }
-
     pt = pa_proplist_to_string_sep(s->proplist, "\n    ");
     pa_log_info("Created sink %u \"%s\" with sample spec %s and channel map %s\n    %s",
                 s->index,
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list