summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2013-12-03 16:54:48 +0200
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-01-08 21:26:40 +0200
commit71816ecb7f81fe7a124cefa2258cfa64046908a1 (patch)
tree0d42c95b792b79f5e75421da0e2e8ca18bd70512
parentd78d8246b41c688303f59d6ba7f34b52132c67b8 (diff)
downloadpulseaudio-71816ecb7f81fe7a124cefa2258cfa64046908a1.tar.gz
sink-input, source-output: Do routing related validity checks immediately after routing
It's more logical that way.
-rw-r--r--src/pulsecore/sink-input.c11
-rw-r--r--src/pulsecore/source-output.c9
2 files changed, 11 insertions, 9 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index e45ecf186..c3967702b 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -325,8 +325,13 @@ int pa_sink_input_new(
pa_return_val_if_fail(sink, -PA_ERR_NOENTITY);
pa_sink_input_new_data_set_sink(data, sink, false);
}
- /* Routing's done, we have a sink. Now let's fix the format and set up the
- * sample spec */
+
+ pa_return_val_if_fail(PA_SINK_IS_LINKED(pa_sink_get_state(data->sink)), -PA_ERR_BADSTATE);
+ pa_return_val_if_fail(!data->sync_base || (data->sync_base->sink == data->sink
+ && pa_sink_input_get_state(data->sync_base) == PA_SINK_INPUT_CORKED),
+ -PA_ERR_INVALID);
+
+ /* Routing's done, we have a sink. Now let's fix the format. */
/* If something didn't pick a format for us, pick the top-most format since
* we assume this is sorted in priority order */
@@ -353,8 +358,6 @@ int pa_sink_input_new(
if (pa_format_info_is_pcm(data->format) && pa_channel_map_valid(&map))
pa_sink_input_new_data_set_channel_map(data, &map);
- pa_return_val_if_fail(PA_SINK_IS_LINKED(pa_sink_get_state(data->sink)), -PA_ERR_BADSTATE);
- pa_return_val_if_fail(!data->sync_base || (data->sync_base->sink == data->sink && pa_sink_input_get_state(data->sync_base) == PA_SINK_INPUT_CORKED), -PA_ERR_INVALID);
r = check_passthrough_connection(pa_sink_input_new_data_is_passthrough(data), data->sink);
if (r != PA_OK)
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 834a4189d..48cd6a048 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -268,8 +268,10 @@ int pa_source_output_new(
pa_source_output_new_data_set_source(data, source, false);
}
- /* Routing's done, we have a source. Now let's fix the format and set up the
- * sample spec */
+ pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE);
+ pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID);
+
+ /* Routing's done, we have a source. Now let's fix the format. */
/* If something didn't pick a format for us, pick the top-most format since
* we assume this is sorted in priority order */
@@ -296,9 +298,6 @@ int pa_source_output_new(
if (pa_format_info_is_pcm(data->format) && pa_channel_map_valid(&map))
pa_source_output_new_data_set_channel_map(data, &map);
- pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE);
- pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID);
-
if (!data->sample_spec_is_set)
data->sample_spec = data->source->sample_spec;