[pulseaudio-discuss] [PATCH v2] bluetooth: Add support for automatic switch between hsp and a2dp profiles
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Fri Oct 31 04:49:08 PDT 2014
On Tue, 2014-10-28 at 12:33 +0100, Pali Rohár wrote:
> On Tuesday 28 October 2014 09:44:53 Tanu Kaskinen wrote:
> > On Sun, 2014-10-19 at 13:42 +0200, Pali Rohár wrote:
> > > I would like to remind this patch.
> > >
> > > This patch for bluetooth headsets will automatically switch
> > > between hsp (phone quality input+output) and a2dp (full
> > > quality output) bluetooth profiles based on running
> > > pulseaudio clients.
> > >
> > > I you want to use microphone of your bluetooth headset you
> > > need to switch to hsp profile (manually or somehow else...
> > > or with this patch).
> > >
> > > This patch will primary use information from "media.role"
> > > and will switch only if "media.role" is phone.
> > >
> > > If "media.role" information is not available (e.g pulseaudio
> > > client did not set it) then in patch is used some heuristic
> > > (ignore resample method peaks, ignore virtual streams,
> > > ignore recording from monitors).
> > >
> > > In previous discussion Arun was against last part -- using
> > > that heuristic and wanted to use only media.role.
> > >
> > > I would like to hear what other developers thinks. There are
> > > more pulseaudio users who want to see this feature in
> > > pulseaudio and it is *bad* that user must open volume
> > > control settings, change bluetooth configuration (switch
> > > from a2dp to hsp) before he wants to make voice call or use
> > > blueooth microphone for other purpose.
> >
> > I'd prefer if the patch would switch the profile to hsp only
> > if a stream has the "phone" role, and only if the application
> > hasn't explicitly configured any other device for the stream.
> >
>
> Ok. And what to do when application does not specify any role?
Nothing.
> > Btw, does this patch actually do what it's supposed to do? It
> > seems to switch the profile in the source output put hook,
> > but at that point the stream has already been routed, so I'd
> > expect the stream to not get routed to the hsp source, since
> > it didn't exist at the time when the routing for the stream
> > was decided.
>
> Patch automatically switch between hsp and a2dp mode in source
> output hook function. Because switching procedure takes some time
> (and it is asynchronous) it is not finished before returning from
> hook function.
As far as I know, switching card profiles is synchronous.
> Once profile switch is done new source card output
> appears and can be used for recording audio. When I configured
> hsp source with high priority in KDE4 multimedia settings PA
> automatically switch to hsp bluetooth card when it is available
> for all exiting source streams.
Ok, so this patch relies on some other policy module to automatically
move streams when a new sink/source appears. I think that's fine for
now.
--
Tanu
More information about the pulseaudio-discuss
mailing list