Parent: 3ec6f74dc95cef929081be90855a104e11130150
Author: Marijn Suijten <marijns95@gmail.com>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2020-07-14 02:58:25
Tree: bd3d5bc0a420a9c0ee9694aff211822445d9810a
audio/avrcp: Always update transport volume regardless of player `Volume` is a special property that not only exists on players but also on the transport (see org.bluez.MediaTransport1). A player is not attached when the controller does not support FEATURE_CATEGORY_1, which is common on headphones without media browsing capabilities. On such audio devices (headphones, in-ears and the like) Absolute Volume is not available unless an external player is registered (org.bluez.Media1.RegisterPlayer) and the device sends a volume event back after that to set a2dp->volume in transport.c to a valid value (causing volume_exists to finally return true). This [1] mail thread denoting the same issue has a solution to at least request capabilities from the controller, but the proposed player object is not created on category 2 devices. Any notifications received on AVRCP_EVENT_VOLUME_CHANGED (avrcp_volume_changed) that is subsequently registered, or handling the result of avrcp_set_volume in avrcp_handle_set_volume will be ignored unless said player is present. This issue is not addressed by adding a fake player but instead dealing with the fact that volume is "special" and available on the transport regardless of the existence of a player. This is confirmed in avrcp_get_capabilities_resp as well which requires a player to register any event except AVRCP_EVENT_VOLUME_CHANGED. The applied solution moves media_transport_update_device_volume out of the player and into avrcp_volume_changed/avrcp_handle_set_volume where it is unconditionally called. These functions are the only users of avrcp_player->set_volume.
Diffstat
| M | profiles/audio/avrcp.c | | | 12 | ++++++++- - - - |
| M | profiles/audio/media.c | | | 16 | - - - - - - - - - - - - - - - - |
2 files changed, 8 insertions(+), 20 deletions(-)