summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-24 22:27:25 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-24 22:27:25 +0100
commit00839ddaa6d305784109a63517f4758b1675dadc (patch)
tree7cb4f6b0da2fcd69fdce0e772480c668e1634dd7
parent7f5fff943f36c8dcb856bf2b3c77b0da9bf581e9 (diff)
make sure we check the sink status for PA_SINK_INPUT_FAIL_ON_SUSPEND only after module-suspend-on-idle had the chance to resume the device
-rw-r--r--src/pulsecore/sink-input.c7
-rw-r--r--src/pulsecore/source-output.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 34217c86..544bb339 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -158,7 +158,6 @@ int pa_sink_input_new(
pa_return_val_if_fail(data->sink, -PA_ERR_NOENTITY);
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);
- pa_return_val_if_fail(!(flags & PA_SINK_INPUT_FAIL_ON_SUSPEND) || pa_sink_get_state(data->sink) != PA_SINK_SUSPENDED, -PA_ERR_BADSTATE);
if (!data->sample_spec_is_set)
data->sample_spec = data->sink->sample_spec;
@@ -228,6 +227,12 @@ int pa_sink_input_new(
if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], data)) < 0)
return r;
+ if ((flags & PA_SINK_INPUT_FAIL_ON_SUSPEND) &&
+ pa_sink_get_state(data->sink) == PA_SINK_SUSPENDED) {
+ pa_log_warn("Failed to create sink input: sink is suspended.");
+ return -PA_ERR_BADSTATE;
+ }
+
if (pa_idxset_size(data->sink->inputs) >= PA_MAX_INPUTS_PER_SINK) {
pa_log_warn("Failed to create sink input: too many inputs per sink.");
return -PA_ERR_TOOLARGE;
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index d63aca15..d8a2363c 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -127,7 +127,6 @@ int pa_source_output_new(
pa_return_val_if_fail(data->source, -PA_ERR_NOENTITY);
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);
- pa_return_val_if_fail(!(flags & PA_SOURCE_OUTPUT_FAIL_ON_SUSPEND) || pa_source_get_state(data->source) != PA_SOURCE_SUSPENDED, -PA_ERR_BADSTATE);
if (!data->sample_spec_is_set)
data->sample_spec = data->source->sample_spec;
@@ -166,6 +165,12 @@ int pa_source_output_new(
if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], data)) < 0)
return r;
+ if ((flags & PA_SOURCE_OUTPUT_FAIL_ON_SUSPEND) &&
+ pa_source_get_state(data->source) == PA_SOURCE_SUSPENDED) {
+ pa_log("Failed to create source output: source is suspended.");
+ return -PA_ERR_BADSTATE;
+ }
+
if (pa_idxset_size(data->source->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) {
pa_log("Failed to create source output: too many outputs per source.");
return -PA_ERR_TOOLARGE;