feat(audio): make virtual output locking configurable - #1011
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (28)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (3)基于 Vue.js 的 Web 配置面板。审查 XSS/CSRF 安全性、 组件设计、状态管理和可访问性。⚙️ CodeRabbit configuration file Files:
平台抽象层代码(Windows/Linux/macOS)。确保各平台实现一致, 注意 Windows API 调用的错误处理和资源释放。⚙️ CodeRabbit configuration file Files:
Sunshine 核心 C++ 源码,自托管游戏串流服务器。审查要点:内存安全、 线程安全、RAII 资源管理、安全漏洞。注意预处理宏控制的平台相关代码。⚙️ CodeRabbit configuration file Files:
🔇 Additional comments (28)
Summary by CodeRabbit
Walkthrough新增 Changes虚拟音频设备锁定
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to When output locking is disabled, a stale preservation decision may carry across streams and cause a later stream to leave the system using the wrong audio output instead of restoring the prior device. This is a bounded Windows audio-routing issue and the PR is mergeable with explicit owner awareness or follow-up. Sequence Diagram(s)sequenceDiagram
participant Windows音频捕获
participant 默认端点变更回调
participant 音频控制
participant 流停止逻辑
Windows音频捕获->>默认端点变更回调: 检测默认输出设备变更
默认端点变更回调->>音频控制: 更新保留默认输出标志
默认端点变更回调-->>Windows音频捕获: 返回是否重新初始化
流停止逻辑->>音频控制: 查询 should_restore_sink()
音频控制-->>流停止逻辑: 返回恢复决定
流停止逻辑->>Windows音频捕获: 恢复或保留当前输出设备
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (22 skipped: 22 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
这是个bug,只是一直没修。正常重装虚拟声卡驱动,或者是卸载虚拟声卡驱动,也能解决。不需要加配置来优化 |
改动概述
新增
virtual_sink_lock配置开关,用于控制串流期间是否强制保持虚拟音频设备为系统默认输出设备。该选项默认开启,因此不会改变现有用户的行为。
关闭该选项后:
改动原因
目前,在使用虚拟音频设备进行串流时,只要 Windows 默认音频输出设备发生变化,Sunshine 就会立即将其重新切换到虚拟音频设备。
这意味着用户即使手动将声音切换到音箱或耳机,也会很快被 Sunshine 强制切回。
这种行为对于副屏串流等场景不够友好。例如,用户在副屏上保持串流的同时,可能希望临时将主机声音切换到本地音箱或耳机,而不希望因此停止串流。
本次改动允许用户关闭这种强制锁定行为,同时不会改变 Sunshine 选择和采集音频设备的方式。
配置行为
virtual_sink_lock关闭该选项后的典型流程:
实现说明
virtual_sink_lock配置项。兼容性
virtual_sink_lock默认开启,因此升级后不会改变现有用户的音频行为。测试
已完成以下检查:
npm run lint:webuinpm run test:webui,119 项测试通过npm run build多语言配置验证和格式检查
使用 MSYS2 UCRT64、GCC 16.2、CMake 和 Ninja 完成 Windows CMake 配置
完成 Windows 原生构建: