fix(render): restore direct PTS pacing - #72
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughPTS 调度器从基于 VSync 槽位和队列的规划方式改为基于 PTS 时间线的直接调度,并新增相位偏移、重缓冲等事件。NativeRender、帧率统计、诊断依赖和相关测试同步更新。 ChangesPTS 调度与呈现集成
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 docstrings
🧪 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 |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/test/cpp/presentation_scheduler_test.cpp`:
- Around line 144-161: Update TestSevereLateFrameDropsThenReanchorsNextFrame and
the scheduler’s consecutive severe-lateness threshold logic so the first
severely late frame immediately returns REBUFFER and reanchors, rather than
returning LATE_DROP. Adjust the assertions and subsequent-frame expectations to
reflect immediate reanchoring while preserving the required lateness and
target-time 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: 7e51016e-4d63-4f1b-b483-845e23abebad
📒 Files selected for processing (11)
nativelib/src/main/cpp/CMakeLists.txtnativelib/src/main/cpp/native_render.cppnativelib/src/main/cpp/native_render.hnativelib/src/main/cpp/presentation_diagnostics.cppnativelib/src/main/cpp/presentation_diagnostics.hnativelib/src/main/cpp/presentation_scheduler.cppnativelib/src/main/cpp/presentation_scheduler.hnativelib/src/main/cpp/video_decoder.cppnativelib/src/main/cpp/video_decoder.hnativelib/src/test/cpp/presentation_observability_test.cppnativelib/src/test/cpp/presentation_scheduler_test.cpp
💤 Files with no reviewable changes (5)
- nativelib/src/main/cpp/presentation_diagnostics.h
- nativelib/src/main/cpp/presentation_diagnostics.cpp
- nativelib/src/main/cpp/CMakeLists.txt
- nativelib/src/test/cpp/presentation_observability_test.cpp
- nativelib/src/main/cpp/native_render.h
🚧 Files skipped from review as they are similar to previous changes (2)
- nativelib/src/main/cpp/presentation_scheduler.cpp
- nativelib/src/main/cpp/presentation_scheduler.h
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.
改了啥呀
RenderOutputBufferAtTimeRenderOutputBufferAtTime调用移出呈现状态锁;渲染 FPS 滚动计算移到统计读取路径为啥要改
上一版严重迟到时把旧帧重新排到未来,会让内容年龄继续增加;逐帧 VSync 观测又在最敏感的解码输出回调中加锁、取样和计算。两者都可能让“看起来更精确”的杂鱼状态实际更粘。
这版严格回到已经验证的恢复边界:稳态余量不冒险压缩,只在确认延迟已经产生时动态回收。单次严重尖峰丢一张旧帧;持续迟到才重锚;小相位偏移只偿还自己的债,不再引入自适应队列、VSync 槽位或动态容量状态机。
验证
c++ -std=c++17 -Wall -Wextra -Werror -I nativelib/src/main/cpp nativelib/src/main/cpp/presentation_scheduler.cpp nativelib/src/test/cpp/presentation_scheduler_test.cpp -o /tmp/moonlight-presentation-scheduler-test && /tmp/moonlight-presentation-scheduler-test: passedc++ -std=c++17 -Wall -Wextra -Werror -I nativelib/src/main/cpp nativelib/src/main/cpp/rolling_frame_rate.cpp nativelib/src/test/cpp/presentation_observability_test.cpp -o /tmp/moonlight-presentation-observability-test && /tmp/moonlight-presentation-observability-test: passedDEVECO_SDK_HOME=/Users/mac/ohos-sdk-cache/6.1-Release-mac/sdk-ci-shape JAVA_HOME=/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home PATH=/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home/bin:$PATH node hvigorw.js assembleApp --mode project -p product=default -p buildMode=debug --no-daemon: BUILD SUCCESSFULgit diff --check: passedSummary by CodeRabbit