Repository navigation
fix: 修复切歌时音频输出流未及时停止 - #382
Merged
imsyy merged 1 commit intoOct 15, 2026
Merged
Conversation
2 of 5 tasks
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.
改动类型
是否包含破坏性变更
改动说明
从 1.0.0 升级到 1.1.0 后,使用耳机播放列表时,歌曲切换后偶尔会进入暂停状态,需要手动点击播放才能继续。这个问题记录在 Issue #259。
排查发现,1.1.0 将音频输出从 Rodio 切换到了 CPAL。切歌时,
PlaybackHandle::stop()只设置stopped标志,让实时回调输出静音,但没有立即暂停底层音频流。旧流在新流创建期间仍可能占用耳机设备,导致输出设备切换异常,最终出现“歌曲已经切换,但播放器处于暂停状态”的现象。本次修复在设置
stopped后立即调用cpal::Stream::pause(),先停止旧的设备流,再释放播放句柄,避免切歌时新旧输出流短暂重叠。关联 Issue
Closes #259
测试情况
cargo test -p audio-engine:103 passed,3 ignored。pnpm test:Node 端 35 passed,Web 端 195 passed。rustfmt --edition 2021 --check native/audio-engine/src/output/playback.rs:通过。pnpm format:通过,未产生格式化改动。pnpm typecheck:通过。pnpm lint:通过,0 errors;仓库现有 2 条 Vue 规则 warning。pnpm build:native:通过。截图 / 录屏
无 UI 改动。
自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交