[pulseaudio-discuss] [PATCH 02/23] Remove create_node from sink input and source output new data

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


Every sink input and source output should have a node, so we don't
need the create_node flag.

In the future there will be need for suppressing the node creation
for some streams (for example, a router may create internal loopback
streams), but let's worry about that later.
---
 src/pulsecore/protocol-native.c |  4 ++--
 src/pulsecore/sink-input.c      | 24 ++++++++----------------
 src/pulsecore/sink-input.h      |  2 --
 src/pulsecore/source-output.c   | 24 ++++++++----------------
 src/pulsecore/source-output.h   |  2 --
 5 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index dc2aae1..e7df4e2 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -687,7 +687,7 @@ static record_stream* record_stream_new(
     if (peak_detect)
         data.resample_method = PA_RESAMPLER_PEAKS;
     data.flags = flags;
-    pa_source_output_new_data_set_create_node(&data, true);
+
     pa_node_new_data_set_fallback_name_prefix(&data.node_data, "native-protocol");
 
     *ret = -pa_source_output_new(&source_output, c->protocol->core, &data);
@@ -1158,7 +1158,7 @@ static playback_stream* playback_stream_new(
     }
     data.sync_base = ssync ? ssync->sink_input : NULL;
     data.flags = flags;
-    pa_sink_input_new_data_set_create_node(&data, true);
+
     pa_node_new_data_set_fallback_name_prefix(&data.node_data, "native-protocol");
 
     *ret = -pa_sink_input_new(&sink_input, c->protocol->core, &data);
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index e4671dc..30acf25 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -233,12 +233,6 @@ bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset
     return true;
 }
 
-void pa_sink_input_new_data_set_create_node(pa_sink_input_new_data *data, bool create) {
-    pa_assert(data);
-
-    data->create_node = create;
-}
-
 void pa_sink_input_new_data_done(pa_sink_input_new_data *data) {
     pa_assert(data);
 
@@ -593,19 +587,17 @@ int pa_sink_input_new(
             &i->sink->silence);
     pa_xfree(memblockq_name);
 
-    if (data->create_node) {
-        if (!data->node_data.description)
-            pa_node_new_data_set_description(&data->node_data, pa_sink_input_get_description(i));
+    if (!data->node_data.description)
+        pa_node_new_data_set_description(&data->node_data, pa_sink_input_get_description(i));
 
-        if (!(i->node = pa_node_new(i->core, &data->node_data))) {
-            pa_log("Failed to create a node for sink input \"%s\".", pa_sink_input_get_description(i));
-            ret = -PA_ERR_INTERNAL;
-            goto fail;
-        }
-
-        i->node->owner = i;
+    if (!(i->node = pa_node_new(i->core, &data->node_data))) {
+        pa_log("Failed to create a node for sink input \"%s\".", pa_sink_input_get_description(i));
+        ret = -PA_ERR_INTERNAL;
+        goto fail;
     }
 
+    i->node->owner = i;
+
     pt = pa_proplist_to_string_sep(i->proplist, "\n    ");
     pa_log_info("Created input %u \"%s\" on %s with sample spec %s and channel map %s\n    %s",
                 i->index,
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 587c799..4035d44 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -317,7 +317,6 @@ typedef struct pa_sink_input_new_data {
 
     bool save_sink:1, save_volume:1, save_muted:1;
 
-    bool create_node;
     pa_node_new_data node_data;
 } pa_sink_input_new_data;
 
@@ -331,7 +330,6 @@ void pa_sink_input_new_data_add_volume_factor_sink(pa_sink_input_new_data *data,
 void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute);
 bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save);
 bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats);
-void pa_sink_input_new_data_set_create_node(pa_sink_input_new_data *data, bool create);
 void pa_sink_input_new_data_done(pa_sink_input_new_data *data);
 
 /* To be called by the implementing module only */
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 41bdc5a..78b07de 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -177,12 +177,6 @@ bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_i
     return true;
 }
 
-void pa_source_output_new_data_set_create_node(pa_source_output_new_data *data, bool create) {
-    pa_assert(data);
-
-    data->create_node = create;
-}
-
 void pa_source_output_new_data_done(pa_source_output_new_data *data) {
     pa_assert(data);
 
@@ -509,19 +503,17 @@ int pa_source_output_new(
     if (o->direct_on_input)
         pa_assert_se(pa_idxset_put(o->direct_on_input->direct_outputs, o, NULL) == 0);
 
-    if (data->create_node) {
-        if (!data->node_data.description)
-            pa_node_new_data_set_description(&data->node_data, pa_source_output_get_description(o));
+    if (!data->node_data.description)
+        pa_node_new_data_set_description(&data->node_data, pa_source_output_get_description(o));
 
-        if (!(o->node = pa_node_new(o->core, &data->node_data))) {
-            pa_log("Failed to create a node for source output \"%s\".", pa_source_output_get_description(o));
-            ret = -PA_ERR_INTERNAL;
-            goto fail;
-        }
-
-        o->node->owner = o;
+    if (!(o->node = pa_node_new(o->core, &data->node_data))) {
+        pa_log("Failed to create a node for source output \"%s\".", pa_source_output_get_description(o));
+        ret = -PA_ERR_INTERNAL;
+        goto fail;
     }
 
+    o->node->owner = o;
+
     pt = pa_proplist_to_string_sep(o->proplist, "\n    ");
     pa_log_info("Created output %u \"%s\" on %s with sample spec %s and channel map %s\n    %s",
                 o->index,
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index 95c2511..e810eed 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -273,7 +273,6 @@ typedef struct pa_source_output_new_data {
 
     bool save_source:1, save_volume:1, save_muted:1;
 
-    bool create_node;
     pa_node_new_data node_data;
 } pa_source_output_new_data;
 
@@ -287,7 +286,6 @@ void pa_source_output_new_data_apply_volume_factor_source(pa_source_output_new_d
 void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool mute);
 bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save);
 bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats);
-void pa_source_output_new_data_set_create_node(pa_source_output_new_data *data, bool create);
 void pa_source_output_new_data_done(pa_source_output_new_data *data);
 
 /* To be called by the implementing module only */
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list