手机连接使用bluez协议栈的音频设备,发现正反向调节无法同步,修复如下:
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index dda9a30..fa3be73 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1621,9 +1621,11 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
if (len != 5)
goto err;
/* Check if event is supported otherwise reject */
- if (!(session->supported_events & (1 << pdu->params[0])))
- goto err;
switch (pdu->params[0]) {
case AVRCP_EVENT_STATUS_CHANGED:
@@ -4516,8 +4518,9 @@ static int avrcp_event(struct avrcp *session, uint8_t id, const void *data)
int err;
/* Verify that the event is registered */
- if (!(session->registered_events & (1 << id)))
- return -ENOENT;
memset(buf, 0, sizeof(buf));
@@ -4577,8 +4580,8 @@ int avrcp_set_volume(struct btd_device *dev, int8_t volume, bool notify)
return -ENOTCONN;
if (notify) {
- if (!session->target)
- return -ENOTSUP;
return avrcp_event(session, AVRCP_EVENT_VOLUME_CHANGED,
&volume);
}
本文描述了在使用bluez协议栈连接音频设备时遇到的正反向调节无法同步的问题,并提供了相应的代码修复,涉及AVRCP_EVENT_STATUS_CHANGED和AVRCP_EVENT_VOLUME_CHANGED事件处理。

被折叠的 条评论
为什么被折叠?



