@@ -3548,12 +3548,13 @@ static void avrcp_volume_changed(struct avrcp *session,
struct avrcp_player *player = target_get_player(session);
uint8_t volume;
- if (!player)
- return;
-
volume = pdu->params[1] & 0x7F;
- player->cb->set_volume(volume, session->dev, player->user_data);
+ /* Always update the transport volume, which is separate from the player */
+ media_transport_update_device_volume(session->dev, volume);
+
+ if (player)
+ player->cb->set_volume(volume, session->dev, player->user_data);
}
static void avrcp_status_changed(struct avrcp *session,
@@ -4296,6 +4297,9 @@ static gboolean avrcp_handle_set_volume(struct avctp *conn, uint8_t code,
volume = pdu->params[0] & 0x7F;
+ /* Always update the transport volume, which is separate from the player */
+ media_transport_update_device_volume(session->dev, volume);
+
if (player != NULL)
player->cb->set_volume(volume, session->dev, player->user_data);
@@ -1202,27 +1202,11 @@ static uint32_t get_duration(void *user_data)
static void set_volume(uint8_t volume, struct btd_device *dev, void *user_data)
{
struct media_player *mp = user_data;
- GSList *l;
if (mp->volume == volume)
return;
mp->volume = volume;
-
- for (l = mp->adapter->endpoints; l; l = l->next) {
- struct media_endpoint *endpoint = l->data;
- struct media_transport *transport;
-
- /* Volume is A2DP only */
- if (endpoint->sep == NULL)
- continue;
-
- transport = find_device_transport(endpoint, dev);
- if (transport == NULL)
- continue;
-
- media_transport_update_volume(transport, volume);
- }
}
static bool media_player_send(struct media_player *mp, const char *name)