[pulseaudio-discuss] [PATCH] sink-input, source-output: Don't remap volume for passthrough streams

Tanu Kaskinen tanuk at iki.fi
Wed May 30 16:50:54 UTC 2018


On Sun, 2018-05-20 at 11:35 +0530, Arun Raghavan wrote:
> This fixes an assert when we try to restore the original volume map on
> the synthesized (100%) volume of a passthrough stream.
> ---
>  src/pulsecore/sink-input.c    | 2 +-
>  src/pulsecore/source-output.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
> index 5a55e93a5..ebe5cc957 100644
> --- a/src/pulsecore/sink-input.c
> +++ b/src/pulsecore/sink-input.c
> @@ -403,7 +403,7 @@ int pa_sink_input_new(
>      if (!data->volume_writable)
>          data->save_volume = false;
>  
> -    if (data->volume_is_set)
> +    if (data->volume_is_set && !pa_sink_input_new_data_is_passthrough(data))
>          /* The original volume channel map may be different than the final
>           * stream channel map, so remapping may be needed. */
>          pa_cvolume_remap(&data->volume, &volume_map, &data->channel_map);
> diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
> index bcef51fdb..17f5da5e1 100644
> --- a/src/pulsecore/source-output.c
> +++ b/src/pulsecore/source-output.c
> @@ -341,7 +341,7 @@ int pa_source_output_new(
>      if (!data->volume_writable)
>          data->save_volume = false;
>  
> -    if (data->volume_is_set)
> +    if (data->volume_is_set && !pa_source_output_new_data_is_passthrough(data))
>          /* The original volume channel map may be different than the final
>           * stream channel map, so remapping may be needed. */
>          pa_cvolume_remap(&data->volume, &volume_map, &data->channel_map);

I already sent a patch for this:
https://patchwork.freedesktop.org/patch/220793/

Our patches are slightly different. Both result in the right behaviour
as far as I can tell. Your patch has the benefit that it does fewer
changes, my patch on the other hand is more logical in that the
condition on which volume_map is initialized and the condition on which
the remapping is done are the same. With your patch volume_map is
unnecessarily initialized with passthrough PCM streams, but the
remapping is (correctly) skipped for those streams.

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list