diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-04-27 13:14:19 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-04-28 13:05:02 -0700 |
commit | fa7828bddd2164408535a9ac45095564e9ebbeea (patch) | |
tree | f673f51edb5440a64d18f889087b541cc94429f6 /src/device.c | |
parent | f65a9c9d21f69942024ea5b9f581533d2788eb2e (diff) | |
download | bluez-fa7828bddd2164408535a9ac45095564e9ebbeea.tar.gz |
transport: Fix not being able to initialize volume properly
In case AVRCP is connected first and
media_transport_update_device_volume is called without any media_player
being available the volume setting would be lost and Transport.Volume
won't be available, so this introduces btd_device_{set,get}_volume
helpers which is used to store the volume temporarely so
media_player_get_device_volume is able to restore it when the transport
is created.
Fixes: https://github.com/bluez/bluez/issues/335
Diffstat (limited to 'src/device.c')
-rw-r--r-- | src/device.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c index 38f4993f2..112bcc1f9 100644 --- a/src/device.c +++ b/src/device.c @@ -274,6 +274,8 @@ struct btd_device { guint store_id; time_t name_resolve_failed_time; + + int8_t volume; }; static const uint16_t uuid_list[] = { @@ -4334,6 +4336,7 @@ static struct btd_device *device_new(struct btd_adapter *adapter, return NULL; device->tx_power = 127; + device->volume = -1; device->db = gatt_db_new(); if (!device->db) { @@ -7303,3 +7306,13 @@ void btd_device_cleanup(void) { btd_service_remove_state_cb(service_state_cb_id); } + +void btd_device_set_volume(struct btd_device *device, int8_t volume) +{ + device->volume = volume; +} + +int8_t btd_device_get_volume(struct btd_device *device) +{ + return device->volume; +} |