[pulseaudio-discuss] [PATCH 13/16] sink-input, source-output: Don't support clients that configure volume but not channels

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Tue Dec 3 23:50:21 PST 2013


This is a niche feature that isn't supported with
pa_stream_new_extended() anyway. If it really is necessary to support
clients that set the volume while also letting the server to choose
the channel configuration, then we should somehow make that feature
work also with pa_stream_new_extended().

Currently letting the server to choose the channels doesn't work at
all with pa_stream_new_extended(). I will fix that, but the approach
that I chose is to leave the channels unset when the client wants the
server to choose the channel configuration, which means that we won't
have access to any channel map information for the volume. Perhaps
there could be pa_stream_set_volume_channel_map() that could be called
between pa_stream_new_extended() and pa_stream_connect()?
---
 src/pulsecore/sink-input.c    | 6 ------
 src/pulsecore/source-output.c | 6 ------
 2 files changed, 12 deletions(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 2085916..2e1dc17 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -286,7 +286,6 @@ int pa_sink_input_new(
     pa_sink_input *i;
     pa_resampler *resampler = NULL;
     char st[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], fmt[PA_FORMAT_INFO_SNPRINT_MAX];
-    pa_channel_map original_cm;
     int r;
     char *pt;
     char *memblockq_name;
@@ -412,8 +411,6 @@ int pa_sink_input_new(
         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;
@@ -443,9 +440,6 @@ int pa_sink_input_new(
         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);
-
     if (data->resample_method == PA_RESAMPLER_INVALID)
         data->resample_method = core->resample_method;
 
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 12974b5..a53be0a 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -221,7 +221,6 @@ int pa_source_output_new(
     pa_source_output *o;
     pa_resampler *resampler = NULL;
     char st[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], fmt[PA_FORMAT_INFO_SNPRINT_MAX];
-    pa_channel_map original_cm;
     int r;
     char *pt;
     pa_sample_spec ss;
@@ -357,8 +356,6 @@ int pa_source_output_new(
         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;
@@ -388,9 +385,6 @@ int pa_source_output_new(
         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);
-
     if (data->resample_method == PA_RESAMPLER_INVALID)
         data->resample_method = core->resample_method;
 
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list