[pulseaudio-discuss] [PATCH v2] bluetooth: Add support for automatic switch between hsp and a2dp profiles

Pali Rohár pali.rohar at gmail.com
Sun Oct 19 04:42:36 PDT 2014


On Sunday 28 September 2014 12:44:13 Pali Rohár wrote:
> With this patch module-bluetooth-policy automatically switch
> from a2dp profile to hsp profile if some application want to
> start recording.
> 
> By default a2dp profile is used for listening music, but for
> VOIP calls is needed profile with microphone support (hsp).
> So this patch will switch to hsp profile if some application
> want to use microphone and after it release it profile is
> switched back to a2dp. So this patch allows to use bluetooth
> microphone automatically without need of user interaction.
> 
> Signed-off-by: Pali Rohár <pali.rohar at gmail.com>
> ---
> Changes since v1:
> * fixed auto switch for newly created bluetooth cards
> * changed logic for ignoring source outputs
>   - do not check for application name
>   - decide only on media.role property if is set
>   - ignore source outputs with peaks resampler (volume desktop
> programs) - ignore source outputs without assigned client
> (virtual streams) - ignore source outputs which are recording
> from monitor of sink ---
>  src/modules/bluetooth/module-bluetooth-policy.c |  214
> ++++++++++++++++++++++- 1 file changed, 212 insertions(+), 2
> deletions(-)
> 
> diff --git a/src/modules/bluetooth/module-bluetooth-policy.c
> b/src/modules/bluetooth/module-bluetooth-policy.c index
> 860868f..e585f70 100644
> --- a/src/modules/bluetooth/module-bluetooth-policy.c
> +++ b/src/modules/bluetooth/module-bluetooth-policy.c
> @@ -35,16 +35,18 @@
> 

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.

-- 
Pali Rohár
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20141019/2401c466/attachment.sig>


More information about the pulseaudio-discuss mailing list