Initial routing of the stream will be done in pa_node_put(), so pa_node_put() needs to be called already in the routing phase of the stream initialization. The initialization of the stream proplist was moved up, because the proplist needs to be available when pa_sink_input_get_description() is called. This change means that modules can't modify the proplist in the FIXATE hook any more, but there are no modules that would need to do that anyway. --- src/pulsecore/sink-input.c | 30 +++++++++++++++--------------- src/pulsecore/source-output.c | 30 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 7d5ce56..eae450f 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -350,6 +350,21 @@ int pa_sink_input_new( goto fail; } + i->proplist = pa_proplist_copy(data->proplist); + + 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; + + pa_node_put(i->node); + if (!data->sink) { pa_sink *sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK); @@ -563,7 +578,6 @@ int pa_sink_input_new( } } - i->proplist = pa_proplist_copy(data->proplist); i->driver = pa_xstrdup(pa_path_get_filename(data->driver)); i->sink = data->sink; i->actual_resample_method = resampler ? pa_resampler_get_method(resampler) : PA_RESAMPLER_INVALID; @@ -632,17 +646,6 @@ int pa_sink_input_new( &i->sink->silence); pa_xfree(memblockq_name); - 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; - 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, @@ -896,9 +899,6 @@ void pa_sink_input_put(pa_sink_input *i) { pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_ADD_INPUT, i, 0, NULL) == 0); - if (i->node) - pa_node_put(i->node); - pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW, i->index); pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], i); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 1232f55..75d9fa7 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -283,6 +283,21 @@ int pa_source_output_new( goto fail; } + o->proplist = pa_proplist_copy(data->proplist); + + 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; + + pa_node_put(o->node); + if (!data->source) { pa_source *source; @@ -516,7 +531,6 @@ int pa_source_output_new( } } - o->proplist = pa_proplist_copy(data->proplist); o->driver = pa_xstrdup(pa_path_get_filename(data->driver)); o->source = data->source; @@ -571,17 +585,6 @@ 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->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; - 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, @@ -787,9 +790,6 @@ void pa_source_output_put(pa_source_output *o) { pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_ADD_OUTPUT, o, 0, NULL) == 0); - if (o->node) - pa_node_put(o->node); - pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_NEW, o->index); pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], o); -- 1.8.3.1