From 9cdbad590b7476b83e2ef240a486fd5159251be8 Mon Sep 17 00:00:00 2001 From: Myrrh Periwinkle Date: Wed, 6 Aug 2025 09:22:47 +0700 Subject: [PATCH] audio: Remove media_player.volume 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 | 8 -------- profiles/audio/avrcp.h | 2 -- profiles/audio/media.c | 14 -------------- 3 files changed, 24 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 2d9d9d8dd..95f3f032a 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3796,7 +3796,6 @@ static void avrcp_get_media_player_list(struct avrcp *session) static void avrcp_volume_changed(struct avrcp *session, struct avrcp_header *pdu) { - struct avrcp_player *player = target_get_player(session); int8_t volume; if (!avrcp_volume_supported(session->controller)) { @@ -3808,9 +3807,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, @@ -4637,7 +4633,6 @@ static gboolean avrcp_handle_set_volume(struct avctp *conn, uint8_t code, void *user_data) { struct avrcp *session = user_data; - struct avrcp_player *player = target_get_player(session); struct avrcp_header *pdu = (void *) operands; int8_t volume; @@ -4650,9 +4645,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 887753ddf..1f46df17d 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 42a2dcb28..9b3042c18 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; @@ -2045,17 +2044,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; @@ -2143,7 +2131,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, @@ -2626,7 +2613,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.47.3