Repository navigation
fix(portal): 修复 iPhone 锁屏冷连接无法自动解锁的问题 - #34
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…he repository Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
非常漂亮的对照实验(开→关→开),坐实了 iPhone 依赖锁屏期间的视频帧。代码只作用于 Portal 等待+确认锁屏阶段,X11 路径不受影响,日志也只有计数,没问题。 我补了一个小提交(b12d1c7):项目约定实验/验收记录不放进仓库,所以移除了 Great ON/OFF/ON experiment. I pushed one small commit (b12d1c7) removing |
|
已合并,感谢!将随 v0.1.29 发布。/ Merged, thanks — ships in v0.1.29. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2efdc76503
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _ = updates.changed() => continue, | ||
| _ = locked.changed() => continue, | ||
| result = tokio::time::timeout(Duration::from_secs(2), | ||
| track.write_sample_with_extensions(*codec, &sample, &extensions)) => { |
There was a problem hiding this comment.
Make the synthetic access-unit write cancellation-safe
When a lock/readiness notification arrives after a backpressured send has begun, either changed() arm wins and drops write_sample_with_extensions in the middle of an access unit (the two-second timeout can do the same). VideoTrack::write_sample_with_extensions advances the shared timestamp up front and the sequence before each awaited packet write (src/video_track.rs:64-70), so the handoff to live capture can start after a partial, unmarked IDR and with a sequence gap, causing loss/NACKs or delayed first video on exactly the slow path this timeout covers. Make this access-unit write cancellation-safe, or allow the in-flight frame to finish before reacting to state changes.
Useful? React with 👍 / 👎.
Refs #29
GNOME 锁屏且 Portal 尚未建立时,官方 iPhone 客户端虽然完成 CONTROL Echo/查询并收到锁屏状态,却不发送自动解锁请求(SimpleAction 15)。现在仅在 Portal 等待就绪、确认锁屏且连接已建立时,通过已协商的视频轨每秒发送一帧生成的黑画面;解锁后由真实视频接续同一条 RTP 时间线。默认启用,无需实验开关。
采集权限、真实屏幕信息和输入仍按 Portal 实际状态处理。编码和发送有超时;采集就绪、拒绝或连接/SCTP 关闭时退出。黑帧使用所选 codec 对应的 FFmpeg libx264/libx265 软件编码器,缺失时明确记录错误。原有锁屏策略及独立文件传输、终端和端口映射连接保持原有行为。
实验结果
2026 年 10 月 17 日,使用同一实验二进制,仅切换黑帧开关;每轮均在 GNOME 锁屏时重启服务,并由 iPhone 首先发起桌面连接,权限报告保持真实状态:
移除开关后的默认版本也完成一次冷连接验收:11:26:13 发出 H.265 黑帧,11:26:17 收到 action 15,11:26:18 自动解锁成功,随后恢复真实视频;用户确认手机正常显示桌面。详细时间线、二进制哈希及结果解释见
docs/experiments/issue-29-locked-video.md。验证范围和限制
run()退出后直接向视频轨发送样本;生产stream_desktop切换由上述 H.265 实机结果覆盖。Review 和自动化验证
独立 review 发现编码完成与解锁/采集就绪同时发生时,旧锁屏状态可能允许多发一帧黑画面。已优先处理状态通知,并在编码前和发送前复查 Portal、锁屏与连接状态;新增定向回归,在编码最后一次 poll 中发布解锁、未知锁状态或采集就绪,验证不会发出黑帧。
review-agent 对修正复审结果为 No findings。该 review 后续修正已做自动化验证,未重新部署或再次进行手机实机验收;上面的实机记录对应此前已安装的默认版本。
cargo test --locked:183 passed,5 ignored。cargo test --locked --features wayland,portal:191 passed,6 ignored。cargo test --locked --features wayland,portal locked_video::tests -- --ignored --nocapture:显式通过 3 项 FFmpeg 解码及虚拟网络测试。cargo build --release --locked --features wayland,portal及git diff --check通过。