[pulseaudio-discuss] [PATCH v1 4/4] device-restore: Remove the ability to restore volumes for sinks.

Tanu Kaskinen tanuk at iki.fi
Mon Mar 18 05:33:08 PDT 2013


On Sun, 2013-03-17 at 21:48 +0100, poljar (Damir Jelić) wrote:
> This change disables volume restoring for sinks that have a port. Sinks
> with ports inherit the restored volume from the port.
> 
> For sinks without ports nothing is changed.
> ---
>  src/modules/module-device-restore.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
> index 8360a05..f5b33c7 100644
> --- a/src/modules/module-device-restore.c
> +++ b/src/modules/module-device-restore.c
> @@ -775,7 +775,7 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data *
>  
>      if ((e = perportentry_read(u, name, new_data->active_port))) {
>  
> -        if (u->restore_volume && e->volume_valid) {
> +        if (u->restore_volume && e->volume_valid && !new_data->active_port) {
>  
>              if (!new_data->volume_is_set) {
>                  pa_cvolume v;
> @@ -823,7 +823,7 @@ static pa_hook_result_t sink_port_hook_callback(pa_core *c, pa_sink *sink, struc
>  
>      if ((e = perportentry_read(u, name, (sink->active_port ? sink->active_port->name : NULL)))) {
>  
> -        if (u->restore_volume && e->volume_valid) {
> +        if (u->restore_volume && e->volume_valid && !sink->active_port) {

You can remove this whole if block. The hook is called when
sink->active_port changes, and it never changes to NULL, so you can
assume here that it's always set.

Now I realized that these patches do nothing for sources. Do you plan to
send separate patches for sources?

-- 
Tanu



More information about the pulseaudio-discuss mailing list