OSDN Git Service

AVRCP: Fix sending volume changed when not registered
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 15 Jan 2013 13:38:54 +0000 (15:38 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 15 Jan 2013 18:06:58 +0000 (20:06 +0200)
Notifications should only be sent if remote device has registered using
RegisterNotification.

profiles/audio/avrcp.c

index 2809b7f..636d3e4 100644 (file)
@@ -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;
 }