From eee0456f729814289d3c0e565d0ba0e3ade638a5 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 15 Jan 2013 15:38:54 +0200 Subject: [PATCH] AVRCP: Fix sending volume changed when not registered Notifications should only be sent if remote device has registered using RegisterNotification. --- profiles/audio/avrcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 2809b7f5b..636d3e4ce 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -2597,7 +2597,8 @@ int avrcp_set_volume(struct audio_device *dev, uint8_t volume) AVC_CTYPE_CONTROL, AVC_SUBUNIT_PANEL, buf, sizeof(buf), avrcp_handle_set_volume, session); - } else { + } else if (session->registered_events & + (1 << AVRCP_EVENT_VOLUME_CHANGED)) { uint8_t id = AVRCP_EVENT_VOLUME_CHANGED; pdu->pdu_id = AVRCP_REGISTER_NOTIFICATION; pdu->params[0] = AVRCP_EVENT_VOLUME_CHANGED; @@ -2609,4 +2610,6 @@ int avrcp_set_volume(struct audio_device *dev, uint8_t volume) AVC_CTYPE_CHANGED, AVC_SUBUNIT_PANEL, buf, sizeof(buf)); } + + return 0; } -- 2.47.3