[pulseaudio-commits] src/pulsecore
Arun Raghavan
arun at kemper.freedesktop.org
Wed May 22 04:52:09 PDT 2013
src/pulsecore/sink-input.c | 13 +++++++++++--
src/pulsecore/source-output.c | 13 +++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
New commits:
commit ae9f6dc35638b6ac3609cb7dc110d859388a6c24
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Mon May 13 21:33:22 2013 +0530
sink-input,source-output: Deal with FIX* flags and extended API
The sample spec fixup when FIX* flags are set was not being propagated
to the pa_format_info, causing the two to be out of sync when FIX* was
used.
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 8b9ee72..db29696 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -384,17 +384,26 @@ int pa_sink_input_new(
if (!data->muted_is_set)
data->muted = FALSE;
- if (data->flags & PA_SINK_INPUT_FIX_FORMAT)
+ if (data->flags & PA_SINK_INPUT_FIX_FORMAT) {
+ pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID);
data->sample_spec.format = data->sink->sample_spec.format;
+ pa_format_info_set_sample_format(data->format, data->sample_spec.format);
+ }
- if (data->flags & PA_SINK_INPUT_FIX_RATE)
+ if (data->flags & PA_SINK_INPUT_FIX_RATE) {
+ pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID);
data->sample_spec.rate = data->sink->sample_spec.rate;
+ pa_format_info_set_rate(data->format, data->sample_spec.rate);
+ }
original_cm = data->channel_map;
if (data->flags & PA_SINK_INPUT_FIX_CHANNELS) {
+ pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID);
data->sample_spec.channels = data->sink->sample_spec.channels;
data->channel_map = data->sink->channel_map;
+ pa_format_info_set_channels(data->format, data->sample_spec.channels);
+ pa_format_info_set_channel_map(data->format, &data->channel_map);
}
pa_assert(pa_sample_spec_valid(&data->sample_spec));
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 96245c7..6e56bd3 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -327,17 +327,26 @@ int pa_source_output_new(
if (!data->muted_is_set)
data->muted = FALSE;
- if (data->flags & PA_SOURCE_OUTPUT_FIX_FORMAT)
+ if (data->flags & PA_SOURCE_OUTPUT_FIX_FORMAT) {
+ pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID);
data->sample_spec.format = data->source->sample_spec.format;
+ pa_format_info_set_sample_format(data->format, data->sample_spec.format);
+ }
- if (data->flags & PA_SOURCE_OUTPUT_FIX_RATE)
+ if (data->flags & PA_SOURCE_OUTPUT_FIX_RATE) {
+ pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID);
+ pa_format_info_set_rate(data->format, data->sample_spec.rate);
data->sample_spec.rate = data->source->sample_spec.rate;
+ }
original_cm = data->channel_map;
if (data->flags & PA_SOURCE_OUTPUT_FIX_CHANNELS) {
+ pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID);
data->sample_spec.channels = data->source->sample_spec.channels;
data->channel_map = data->source->channel_map;
+ pa_format_info_set_channels(data->format, data->sample_spec.channels);
+ pa_format_info_set_channel_map(data->format, &data->channel_map);
}
pa_assert(pa_sample_spec_valid(&data->sample_spec));
More information about the pulseaudio-commits
mailing list