[PATCH] alsa-sink/source: Really set volumes on port change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/03/2012 09:42 PM, David Henningsson wrote:
> If deferred volumes were activated, set_volume does not really set
> the volume, and is probably only meant to be called from the main
> thread.
> As we're currently really setting the port and the mute here (i e
> modifying ALSA), we should really modify the volume as well.
>
> Signed-off-by: David Henningsson<david.henningsson at canonical.com>

Colin and Arun gave it a quick review and thought it made sense, and 
I've tested it here and it seems to fix things and not break them, so 
pushed now.

> ---
>
> Ok, so I believe I finally found something that could be the cause,
> or at least one of the causes, of my volume control problems.
>
> As this still is tricky stuff, I'm happy for additional eyes, but will
> push in a day or two if I get none. Also cc:ing Jyri Sasha on this one
> as he wrote the deferred volume stuff originally.
>
>   src/modules/alsa/alsa-sink.c   |    9 +++++++--
>   src/modules/alsa/alsa-source.c |    9 +++++++--
>   2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
> index ea5188c..65f12c2 100644
> --- a/src/modules/alsa/alsa-sink.c
> +++ b/src/modules/alsa/alsa-sink.c
> @@ -1465,8 +1465,13 @@ static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
>
>       if (s->set_mute)
>           s->set_mute(s);
> -    if (s->set_volume)
> -        s->set_volume(s);
> +    if (s->flags&  PA_SINK_DEFERRED_VOLUME) {
> +        if (s->write_volume)
> +            s->write_volume(s);
> +    } else {
> +        if (s->set_volume)
> +            s->set_volume(s);
> +    }
>
>       return 0;
>   }
> diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
> index 2680302..ab7335d 100644
> --- a/src/modules/alsa/alsa-source.c
> +++ b/src/modules/alsa/alsa-source.c
> @@ -1368,8 +1368,13 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
>
>       if (s->set_mute)
>           s->set_mute(s);
> -    if (s->set_volume)
> -        s->set_volume(s);
> +    if (s->flags&  PA_SOURCE_DEFERRED_VOLUME) {
> +        if (s->write_volume)
> +            s->write_volume(s);
> +    } else {
> +        if (s->set_volume)
> +            s->set_volume(s);
> +    }
>
>       return 0;
>   }



-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux