[pulseaudio-discuss] [PATCH] bluetooth: When doing autoswitch call pa_card_set_profile with save=true

Pali Rohár pali.rohar at gmail.com
Thu Aug 4 07:11:56 UTC 2016


On Thursday 04 August 2016 09:29:58 Arun Raghavan wrote:
> On Tue, 2 Aug 2016, at 12:50 AM, Pali Rohár wrote:
> > When pa_card_set_profile is called with save=false then
> > module-card-restore
> > start fight with module-bluetooth-policy and every second is profile
> > changing between hsp and a2dp.
> > 
> > So when pulseaudiu is changing profile in module-bluetooth-policy we need
> > to save it and tell module-card-restore to not try to restore old
> > profile.
> > 
> > Signed-off-by: Pali Rohár <pali.rohar at gmail.com>
> > ---
> >  src/modules/bluetooth/module-bluetooth-policy.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/modules/bluetooth/module-bluetooth-policy.c
> > b/src/modules/bluetooth/module-bluetooth-policy.c
> > index 68c8ab4..74ae898 100644
> > --- a/src/modules/bluetooth/module-bluetooth-policy.c
> > +++ b/src/modules/bluetooth/module-bluetooth-policy.c
> > @@ -159,7 +159,7 @@ static void card_set_profile(struct userdata *u,
> > pa_card *card, const char *to_p
> >  
> >          pa_log_debug("Setting card '%s' to profile '%s'", card->name,
> >          to_profile);
> >  
> > -        if (pa_card_set_profile(card, profile, false) != 0) {
> > +        if (pa_card_set_profile(card, profile, true) != 0) {
> >              pa_log_warn("Could not set profile '%s'", to_profile);
> >              continue;
> >          }
> > -- 
> 
> This is not actually what we want to do. Automatic switching should not
> make module-card-restore save the desired profile.

What is wrong with it?

> The short workaround for this is to register the hook in
> module-bluetooth-policy with priority later than module-card-restore.

I think that this does not work. That restore module is watching for
available profiles and after some delay (1s?) it change profile.

What is needed is to tell that restore module should not touch profiles
set by bluetooth policy.

> That said, I'm not sure it's a good thing for hooks to be fighting to
> set the profile. I would rather have them select the profile and at the
> end of running hooks, if something provided a profile, we set it.

I think this will not work too, as later restore module again see that
a2dp is available and switch to them...

> Tanu, since you added the original code -- wdyt?
> 
> -- Arun
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

-- 
Pali Rohár
pali.rohar at gmail.com


More information about the pulseaudio-discuss mailing list