feat(render): add optional two-step precise sync - #58
Conversation
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChanges新增二步精确同步实验开关,贯通设置持久化、串流配置、NAPI 与 NativeRender;同时扩展解码器呈现时间输入,并实现基于 VSync 相位的预计算、对齐及回退流程。 二步精确同步配置与入口
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
nativelib/src/main/cpp/native_render.cpp (1)
503-504: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
enqueueTimeMs参数已成为死参数。
SubmitFrame内部直接(void)enqueueTimeMs;,二步/基线两条路径都不再使用它,仅在调用处(video_decoder.cpp 两处)继续传入。可考虑收拾掉签名,减少无用参数。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nativelib/src/main/cpp/native_render.cpp` around lines 503 - 504, Remove the unused enqueueTimeMs parameter from NativeRender::SubmitFrame and delete its (void) suppression. Update both SubmitFrame call sites in video_decoder.cpp to stop passing enqueueTimeMs, while preserving the existing frame-submission behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@nativelib/src/main/cpp/moonlight_bridge.cpp`:
- Line 2011: 在 nativelib/src/main/cpp/moonlight_bridge.cpp#L2011-L2011 的
SetTwoStepPreciseSyncEnabled 调用处获取 NativeRender::GetInstance() 的局部指针并判空后再调用;在
nativelib/src/main/cpp/moonlight_bridge.cpp#L2020-L2025 的
IsTwoStepPreciseSyncEnabled 调用处同样引入局部变量并判空,遵循 MoonBridge_SetVsyncEnabled
的安全调用模式。
---
Nitpick comments:
In `@nativelib/src/main/cpp/native_render.cpp`:
- Around line 503-504: Remove the unused enqueueTimeMs parameter from
NativeRender::SubmitFrame and delete its (void) suppression. Update both
SubmitFrame call sites in video_decoder.cpp to stop passing enqueueTimeMs, while
preserving the existing frame-submission behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 786b8422-390f-41a8-a9e3-f6f5661843f9
📒 Files selected for processing (12)
entry/src/main/ets/model/StreamConfig.etsentry/src/main/ets/pages/SettingsPageV2.etsentry/src/main/ets/service/SettingsService.etsentry/src/main/ets/service/streaming/StreamingSession.etsnativelib/src/main/cpp/callbacks.cppnativelib/src/main/cpp/moonlight_bridge.cppnativelib/src/main/cpp/moonlight_bridge.hnativelib/src/main/cpp/napi_init.cppnativelib/src/main/cpp/native_render.cppnativelib/src/main/cpp/native_render.hnativelib/src/main/cpp/video_decoder.cppnativelib/src/main/cpp/video_decoder.h
改了啥呀
为啥要改
网络突发和解码耗时会让连续帧一起到达。只在解码输出时决定呈现时间,已经来不及恢复主机原本的节奏;只按目标时间呈现,又可能落在两个屏幕刷新点之间。
这次把两件事分开做:先把主机帧节奏整理平,再落到真实屏幕刷新点。这样帧不会因为一阵快、一阵慢就忽快忽慢,杂鱼抖动乖乖排队啦。
安全边界
验证
node hvigorw.js assembleHar --mode module -p module=nativelib@default -p product=default -p buildMode=debug --no-daemon --stacktracenode hvigorw.js assembleApp --mode project -p product=default -p buildMode=debug --no-daemon --stacktracegit diff --check以上均通过。
Summary by CodeRabbit