diff options
author | Marijn Suijten <marijn.suijten@somainline.org> | 2021-08-08 16:35:55 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-08-09 13:33:53 -0700 |
commit | 44e1bcffcd491ae1e7d5904e44c9bc6d296d0093 (patch) | |
tree | 303d52480019ea4abb18279f38bd7692ebcad84b /profiles | |
parent | e21680c9355a0f9d5ef6d4a5ae032de274e87b37 (diff) | |
download | bluez-44e1bcffcd491ae1e7d5904e44c9bc6d296d0093.tar.gz |
audio/transport: Only store volume when also emitting DBus prop change
By setting a2dp->volume early in set_volume() the resulting call to
media_transport_update_volume() when an AVRCP reply is received will
likely see the same volume received (unless the peer rounded it to
another value) and bail on equality, before emitting a DBus property
change. This results in DBus clients not being made aware of the change
unless the peer is an audio source (that receives a notification about
changed volume, instead of a command to _set_ a new volume), where
set_volume() immediately raises the DBus signal.
This issue is observed when playing back audio to headphones through an
AbsoluteVolume-enabled audio server like PulseAudio, which does not
receive the "Volume" change (while the peer does change volume) when
setting this property externally using ie. dbus-send.
Diffstat (limited to 'profiles')
-rw-r--r-- | profiles/audio/transport.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 8248014ae..d158fc97a 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -659,14 +659,14 @@ static void set_volume(const GDBusPropertyTable *property, if (a2dp->volume == volume) return; - a2dp->volume = volume; - notify = transport->source_watch ? true : false; - if (notify) + if (notify) { + a2dp->volume = volume; g_dbus_emit_property_changed(btd_get_dbus_connection(), transport->path, MEDIA_TRANSPORT_INTERFACE, "Volume"); + } avrcp_set_volume(transport->device, volume, notify); return; |