[pulseaudio-discuss] [PATCH v3 2/2] bluetooth: Add optional heuristic for switching between hsp and a2dp profiles

Pali Rohár pali.rohar at gmail.com
Tue May 5 05:43:43 PDT 2015

On Tuesday 05 May 2015 17:40:28 Arun Raghavan wrote:
> On 1 November 2014 at 04:20, Pali Rohár <pali.rohar at gmail.com> wrote:
> > Not all VOIP applications (specially those which use alsa) set media.role to
> > phone. This means we need some heuristic to determinate if we want to switch
> > from a2dp to hsp profile based on number and types of source output (recording)
> > streams. Some people want to use their bluetooth headset (with microphone) as
> > their default recording device but some do not want to because of low quality.
> >
> > This patch implements some heuristic in module-bluetooth-policy module to decide
> > if pulseaudio should switch to hsp profile or not. It check if there is some
> > source output with pass all these conditions:
> >
> > * does not have set media.role
> > * do not use peak resample method (which is used by desktop volume programs)
> > * has assigned client/application (non virtual stream)
> > * do not record from monitor of sink
> >
> > And if yes it switch to hsp profile.
> >
> > By default this heuristic is disabled and can be enabled when loading module
> > module-bluetooth-policy with specifying parameter switch=2
> >
> > Signed-off-by: Pali Rohár <pali.rohar at gmail.com>
> > ---
> This patch is a NACK from me. I disagree with the validity of the
> heuristic, and think that the two workarounds I've mentioned in the
> original thread (repeated below) are sufficient. I don't want to carry
> additional code for this corner case.

I disagree. They are not. Otherwise we would not see people complaining
about non working microphone and autoswitch of bluetooth headsets.

And by default heuristic is disabled, so it does anything on your

> 1. Patch the app to appropriately set a role, set it via an env.
> variable if you can't

Already said it is not possible for 3rd closed application and alsa
applications (which do not use pulseaudio).

> 2. User specifically opts in for recording from the HSP source via UI
> if that's really what he/she wants to do
> -- Arun

It is stupid and not usable for regular work. If there is e.g. incomming
voice call user does not have time to find correct UI, switch someting
and after long period (when he do everything that) is microphone active
and can answer call.

Pali Rohár
pali.rohar at gmail.com

More information about the pulseaudio-discuss mailing list