pulseaudio/src/modules/bluetooth
Marijn Suijten 8db4dff2c5 bluetooth: Set up hardware gain control if init volume is received late
Originally written for A2DP this rework of that patch enables late-bound
hardware volume control on HFP and HSP.  As per the specification the
headphones (where gain control for both speaker and microphone could
happen in hardware on the peer) are supposed to send initial values for
these before the SCO connection is created; these `AT+VG[MS]` commands
are also used to determine support for it.  PA uses this information in
`add_{sink,source}` to attach hardware volume callbacks, _if_ it is
supported.  Otherwise PA performs the attenuation in software.

Unfortunately headphones like the WH-1000XM3's connect to A2DP
initially and only send `AT+VGS` (microphone hardware gain is not
supported) _during_ SCO connection when the user switches to the HFP
profile afterwards; the callbacks set up dynamically in
`rfcomm_io_callback` are written after the sink and source have been
created (`add_{sink,source}`), leaving them without hardware volume
callbacks and with software volume when adjusted on the PA side.  (The
headphones can still send volume updates resulting in abrupt changes if
software and peer volume differ.  Furthermore the same attenuation is
applied twice - once in PA software, once on the peer).

To solve this problem we simply check whether the callbacks have been
attached whenever the peer sends a volume change, and if not attach the
callbacks to the sink/source and reset software volume.

Fixes: d510ddc7f ("bluetooth: Perform software attenuation until HF/HS reports gain control")
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/528>
2021-03-17 22:57:38 +01:00
..
a2dp-codec-api.h bluetooth: pass output_rate_refresh_interval_ms module parameter 2021-01-26 10:01:47 +03:00
a2dp-codec-aptx-gst.c bluetooth/gst: Unify encoder and decoder pipeline setup 2021-02-01 17:23:46 +00:00
a2dp-codec-gst.c bluetooth/gst: Unify encoder and decoder pipeline setup 2021-02-01 17:23:46 +00:00
a2dp-codec-gst.h bluetooth/gst: Unify encoder and decoder pipeline setup 2021-02-01 17:23:46 +00:00
a2dp-codec-ldac-gst.c bluetooth/gst: Unify encoder and decoder pipeline setup 2021-02-01 17:23:46 +00:00
a2dp-codec-sbc.c bluetooth: support increasing bitrate for SBC XQ 2021-02-01 17:10:52 +00:00
a2dp-codec-util.c bluetooth: a2dp dual channel SBC XQ codec configurations 2021-02-01 17:10:52 +00:00
a2dp-codec-util.h bluetooth: Add missing can_be_supported check to is_codec_available 2021-01-21 15:03:39 +01:00
a2dp-codecs.h bluetooth: Update a2dp-codecs.h from upstream bluez project 2019-04-12 13:56:28 +03:00
backend-native.c bluetooth: accept +VGM/+VGS unsolicited reply with '=' and ':' separator 2021-03-16 10:48:59 +01:00
backend-ofono.c treewide: fix a bunch of typos 2021-02-26 19:58:41 -03:00
bluez5-util.c bluetooth: Move attenuation decision to shared function 2021-03-16 10:48:58 +01:00
bluez5-util.h bluetooth: Move attenuation decision to shared function 2021-03-16 10:48:58 +01:00
meson.build bluetooth: Add aptX support via GStreamer 2021-01-19 13:43:42 +05:30
module-bluetooth-discover.c bluetooth: Remove leftover references to the BlueZ 4/5 split 2018-07-27 11:28:11 +03:00
module-bluetooth-policy.c bluetooth: complete bluetooth profile separation 2021-02-23 06:54:39 +00:00
module-bluez5-device.c bluetooth: Set up hardware gain control if init volume is received late 2021-03-17 22:57:38 +01:00
module-bluez5-discover.c bluetooth: enable module-bluez5-discover argument enable_native_hfp_hf 2021-02-23 06:54:39 +00:00
rtp.h bluetooth: Fix usage of RTP structures in SBC codec 2019-07-24 17:29:45 +03:00