From 3de9f445fa230383f66755ef5f42f94f12a5d1aa Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 20 Feb 2019 20:30:12 +0530 Subject: [PATCH] sink-input,source-output: Disallow volume change on passthrough streams We shouldn't be setting volumes on these streams as that would change the content. --- src/pulsecore/sink-input.c | 5 +++++ src/pulsecore/source-output.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 03518845b..be2309023 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -1422,6 +1422,11 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, bool s pa_assert(volume->channels == 1 || pa_cvolume_compatible(volume, &i->sample_spec)); pa_assert(i->volume_writable); + if (pa_sink_input_is_passthrough(i) && !pa_cvolume_is_norm(volume)) { + pa_log_info("Not changing volume for passthrough sink input"); + return; + } + if (!absolute && pa_sink_flat_volume_enabled(i->sink)) { v = i->sink->reference_volume; pa_cvolume_remap(&v, &i->sink->channel_map, &i->channel_map); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 679475379..221c05598 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -1006,6 +1006,11 @@ void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, pa_assert(volume->channels == 1 || pa_cvolume_compatible(volume, &o->sample_spec)); pa_assert(o->volume_writable); + if (pa_source_output_is_passthrough(o) && !pa_cvolume_is_norm(volume)) { + pa_log_info("Not changing volume for passthrough source output"); + return; + } + if (!absolute && pa_source_flat_volume_enabled(o->source)) { v = o->source->reference_volume; pa_cvolume_remap(&v, &o->source->channel_map, &o->channel_map);