bluetooth: Report a2dp_source volume changes to the source device
authorMarijn Suijten <marijns95@gmail.com>
Thu, 16 Jan 2020 14:39:41 +0000 (15:39 +0100)
committerPulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org>
Mon, 17 May 2021 14:50:03 +0000 (14:50 +0000)
commitc6b771537ef3c31c13e902ccceb2ae16949695bb
treee380fe66a742a3481668406e7a40e99571271864
parentac21b07ad6ba2d0454ab54118359f9b5b1172db2
bluetooth: Report a2dp_source volume changes to the source device

Write the current volume to the `Volume` DBus property to keep the
volume on the remote in sync.  Without this the remote device shows the
wrong volume, and any attempts to change it will cause an unexpected
jump when the local volume has also been adjusted.

Thanks to prior investments to improve volume synchronization, setting
up callbacks and sending initial volume to the peer for HFP/HSP
implementing this feature is as easy as unconditionally assigning a
valid function to `set_source_volume`.  `source_setup_volume_callback`
is already responsible for attaching a `SOURCE_VOLUME_CHANGED` hook and
sending initial (restored) volume to the peer (signifying support for
Absolute Volume - if not derived from the presence of FEATURE_CATEGORY_2
on the profile yet).

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/239>
src/modules/bluetooth/bluez5-util.c
src/modules/bluetooth/module-bluez5-device.c