feat(video): 暂停时释放防息屏锁

- VideoPlugin 在收到 Pause 命令时发送 ScreenLockRequest(false)
- VideoPlugin 在收到 Play 命令时发送 ScreenLockRequest(true)
- 恢复旧版 video_processor.rs 的暂停/恢复防息屏行为
- ScreenPlugin 收到消息后执行 stop_wake_lock()/start_wake_lock()

修改文件:
- src/plugins/video/mod.rs: 在 PlayerCommand::Pause/Play 处理中发送消息

验证:
- cargo check 通过,零 warning
- 行为与旧版一致:暂停释放锁,恢复获取锁
This commit is contained in:
showen
2026-03-12 12:58:26 +08:00
parent cc4d6935d9
commit 9daf65d1fb

View File

@@ -1839,3 +1839,30 @@ M Cargo.lock
- cargo check: **零 warning**
- cargo test: **22/22 通过**
- M1.1 进度: **85%**
---
[当前] 赵雨薇(前端与屏幕工程师) → 刘建国(PM), 陈逸飞(CEO): 暂停时释放防息屏功能已实现。
任务背景:
旧版 `video_processor.rs` 在暂停时会释放防息屏锁kill systemd-inhibit恢复时重新获取。新版架构中防息屏在 ScreenPlugin 中VideoPlugin 暂停时没有通知 ScreenPlugin 释放锁。
实现方案:
- 在 `src/plugins/video/mod.rs` 的 `handle_message()` 中:
- 收到 `PlayerCommand::Pause` 时,发送 `Message::ScreenLockRequest(false)` 到 `screen` 插件
- 收到 `PlayerCommand::Play` 时,发送 `Message::ScreenLockRequest(true)` 到 `screen` 插件
- ScreenPlugin 已有 `ScreenLockRequest` 消息处理逻辑line 154-160会调用 `start_wake_lock()` 或 `stop_wake_lock()`
修改文件:
- `src/plugins/video/mod.rs` (line 142-169)
验证结果:
- ✅ `cargo check` 通过,零 warning
- ✅ 代码逻辑与旧版行为一致:暂停释放锁,恢复获取锁
行为说明:
- 暂停时VideoPlugin 发送 `ScreenLockRequest(false)` → ScreenPlugin 执行 `stop_wake_lock()` → kill systemd-inhibit 进程
- 恢复时VideoPlugin 发送 `ScreenLockRequest(true)` → ScreenPlugin 执行 `start_wake_lock()` → 重新启动 systemd-inhibit
- 这与旧版 `video_processor.rs:578-588` 的行为完全一致
---