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

poljar (Damir Jelić) poljarinho at gmail.com
Mon Mar 18 12:02:26 PDT 2013


On Mon, Mar 18, 2013 at 02:33:08PM +0200, Tanu Kaskinen wrote:
> 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?
> 

Yes. After I sort out all the issues for the sinks I will send a
patchset with similiar changes for sources or do you prefer me to do
that right away?


More information about the pulseaudio-discuss mailing list