With the previous commit, the media_player.volume field is now completely unused. As this was never the right place to store the initial volume to begin with, remove this field entirely as well as its associated supporting methods to prevent confusion. --- profiles/audio/avrcp.c | 6 ------ profiles/audio/avrcp.h | 2 -- profiles/audio/media.c | 14 -------------- 3 files changed, 22 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index ec07522e6a34eb1dc5f6f413f48f1087a609df9a..5087da4c2c90f76fc92d95152e50c7dddd0a8b11 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3808,9 +3808,6 @@ static void avrcp_volume_changed(struct avrcp *session, /* Always attempt to update the transport volume */ 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, @@ -4650,9 +4647,6 @@ static gboolean avrcp_handle_set_volume(struct avctp *conn, uint8_t code, /* Always attempt to update the transport volume */ media_transport_update_device_volume(session->dev, volume); - if (player != NULL) - player->cb->set_volume(volume, session->dev, player->user_data); - return FALSE; } diff --git a/profiles/audio/avrcp.h b/profiles/audio/avrcp.h index 887753ddf28643800fabbddb1bf0941ed3930463..1f46df17d48e7c1d22ccf97bc7804e21372f5882 100644 --- a/profiles/audio/avrcp.h +++ b/profiles/audio/avrcp.h @@ -83,8 +83,6 @@ struct avrcp_player_cb { uint32_t (*get_position)(void *user_data); uint32_t (*get_duration)(void *user_data); const char *(*get_name)(void *user_data); - void (*set_volume)(int8_t volume, struct btd_device *dev, - void *user_data); bool (*play)(void *user_data); bool (*stop)(void *user_data); bool (*pause)(void *user_data); diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 55f1482d1d9ce52e104481bab3ede373f47aee0c..fd6e30f042ecee9882694059fcf72daf5e0eb436 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -142,7 +142,6 @@ struct media_player { char *status; uint32_t position; uint32_t duration; - int8_t volume; GTimer *timer; bool play; bool pause; @@ -2036,17 +2035,6 @@ static uint32_t media_player_get_duration(void *user_data) return mp->duration; } -static void media_player_set_volume(int8_t volume, struct btd_device *dev, - void *user_data) -{ - struct media_player *mp = user_data; - - if (mp->volume == volume) - return; - - mp->volume = volume; -} - static bool media_player_send(struct media_player *mp, const char *name) { DBusMessage *msg; @@ -2134,7 +2122,6 @@ static struct avrcp_player_cb player_cb = { .get_duration = media_player_get_duration, .get_status = media_player_get_status, .get_name = media_player_get_player_name, - .set_volume = media_player_set_volume, .play = media_player_play, .stop = media_player_stop, .pause = media_player_pause, @@ -2617,7 +2604,6 @@ static struct media_player *media_player_create(struct media_adapter *adapter, mp->sender = g_strdup(sender); mp->path = g_strdup(path); mp->timer = g_timer_new(); - mp->volume = -1; mp->watch = g_dbus_add_disconnect_watch(conn, sender, media_player_exit, mp, -- 2.50.1