]> code.delx.au - pulseaudio/commitdiff
sink-input, source-output: Check rate update success for passthrough
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 19 Nov 2012 07:22:28 +0000 (12:52 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 19 Nov 2012 07:40:36 +0000 (13:10 +0530)
This makes sure we don't try to plug in a passthrough stream if the
final sink/source sample spec doesn't match what we want. In the future,
we might want to change rate updates to try a full sample spec update
for passthrough streams.

https://bugs.freedesktop.org/show_bug.cgi?id=50951

src/pulsecore/sink-input.c
src/pulsecore/source-output.c

index a5edd21ccd291c94f76224d357071e8906df4213..aaabf5c31d5cdcec9375f73a1f8fa5799666d194 100644 (file)
@@ -374,6 +374,14 @@ int pa_sink_input_new(
             pa_log_info("Rate changed to %u Hz", data->sink->sample_spec.rate);
     }
 
+    if (pa_sink_input_new_data_is_passthrough(data) &&
+        !pa_sample_spec_equal(&data->sample_spec, &data->sink->sample_spec)) {
+        /* rate update failed, or other parts of sample spec didn't match */
+
+        pa_log_debug("Could not update sink sample spec to match passthrough stream");
+        return -PA_ERR_NOTSUPPORTED;
+    }
+
     /* Due to the fixing of the sample spec the volume might not match anymore */
     pa_cvolume_remap(&data->volume, &original_cm, &data->channel_map);
 
index 6db2cbde9ae315b1715fdf58154a211853fe65b9..8775c1ea50005f43a5b0f0e1cd925c4724f7a898 100644 (file)
@@ -350,6 +350,14 @@ int pa_source_output_new(
             pa_log_info("Rate changed to %u Hz", data->source->sample_spec.rate);
     }
 
+    if (pa_source_output_new_data_is_passthrough(data) &&
+        !pa_sample_spec_equal(&data->sample_spec, &data->source->sample_spec)) {
+        /* rate update failed, or other parts of sample spec didn't match */
+
+        pa_log_debug("Could not update source sample spec to match passthrough stream");
+        return -PA_ERR_NOTSUPPORTED;
+    }
+
     /* Due to the fixing of the sample spec the volume might not match anymore */
     pa_cvolume_remap(&data->volume, &original_cm, &data->channel_map);