Repository navigation
Conversation
wxs7655
force-pushed
the
fix/wasapi-exclusive-bit-depth
branch
from
November 7, 2026 12:56
cf82a8e to
607bdfe
Compare
This branch has not been deployed
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.
改动类型
是否包含破坏性变更
改动说明
WASAPI 独占模式位深协商存在候选缺口:24bit 音源只按"24bit 有效位 + 32bit 容器"(24-in-32)探测,且从不为 24bit 音源尝试 32bit 格式。独占格式表只接受打包 24bit(24-in-24)或仅暴露 32-in-32 的设备(大量 USB DAC 如此)会因此所有高格式候选都探测失败,恒定落到 16bit 兜底候选——表现为"设备支持 24/32bit 但音频位深锁定 16bit",且换歌无法恢复(每次重新协商都重复失败)。
主要变更:
valid_bits_candidates:24bit 音源补 32bit 候选([24, 32, 16]),16bit 及以下音源补 32bit 兜底,覆盖只暴露 32bit 容器的设备container_candidates:24bit 有效位深先按 32bit 容器探测(保持既有设备行为不变),再补打包 24bit(24-in-24)pcm.rs:样本写入按"容器位深 - 有效位深"左移补零,支持 3 字节打包容器;convert_sample改为返回未移位的有效位深样本,容器对齐统一在fill_buffer完成关联 Issue
无(源于 WASAPI 独占模式位深协商的代码审查与复现)
测试情况
fill_buffer在 24-in-24 / 24-in-32 下的字节布局;同步更新convert_sample既有断言以匹配新契约cargo check -p audio-engine --target x86_64-pc-windows-gnu --tests交叉编译检查通过;rustfmt校验通过test.yml(windows-latest 执行pnpm test:native)运行截图 / 录屏
修复后:

自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交