sink-input, source-output: Check rate update success for passthrough

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
This commit is contained in:
Arun Raghavan 2012-11-19 12:52:28 +05:30
parent da4163a85e
commit 3effdfc16f
2 changed files with 16 additions and 0 deletions

View 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);

View 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);