refactor(audio): pack double audio data into a packet#227
Merged
Conversation
awalol
marked this pull request as ready for review
July 8, 2026 07:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
更改了什么
总体更改
特别感谢 @Nielk1 的研究报告和分享的抓包片段让我更深入了解了 DS5 的数据包
这次变动将音频发送周期变为约 20ms,减缓蓝牙压力。
在 48 缓冲区的测试中,感觉和之前的方案得到的效果没有区别。
这次修改的优点是移除了 StateMgr,可避免因 StateMgr 造成的普通震动、自适应扳机工作不正常现象的发生。
极限测试,在 2ms 周期的 SetState 音频没有卡顿,1ms 就不行了
细节更改
将 crc32_lookup_table 移动到内存中存储
将 l2cap_request_can_send_now_event 移动到内存中运行
为 haptics 增加过滤器,避免 3000hz 以上的音频造成的声音干扰
未完成的工作
What Changed
Overall Changes
Special thanks to @Nielk1 for their research report and shared packet samples, which helped me gain a deeper understanding of DS5 packets.
This change adjusts the audio transmission interval to approximately 20 ms, reducing Bluetooth pressure.
In tests with a 48-buffer setup, the result felt no different from the previous approach.
The advantage of this change is that it removes StateMgr, which avoids issues caused by StateMgr where normal vibration and adaptive triggers may not work correctly.
Detailed Changes
Moved
crc32_lookup_tableinto memory storage.Moved
l2cap_request_can_send_now_eventto run from memory.Added a filter for haptics to prevent audio above 3000 Hz from causing noise interference.
Unfinished Work
0x80/0x81test commands are broken. These will be stored through a unified manager in the future.