Skip to content

fix(render): scope burst headroom to high refresh - #65

Merged
qiin2333 merged 3 commits into
masterfrom
codex/scope-high-refresh-pacing
Jul 20, 2026
Merged

fix(render): scope burst headroom to high refresh#65
qiin2333 merged 3 commits into
masterfrom
codex/scope-high-refresh-pacing

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 使用三级 future-lead 预算:<=60 FPS 半帧、61-119 FPS 一帧、>=119.88 FPS 两帧
  • 119.88/120+ FPS 现在可保留三帧 decoder burst 的 PTS 间隔,第四帧才触发 catch-up
  • 所有帧率继续使用 2 ms 稳态提交余量;30/60 FPS 的延迟边界不变
  • 增加 30、60、90、119、119.88、120 FPS 边界测试,并修正 59.94 FPS 预算断言

为啥要改

一帧 future lead 已让 120 FPS 比 PR63 更容易跑满,但真机仍会间歇掉帧,说明这个小杂鱼硬解偶尔会一次吐出三帧。120 FPS 下把瞬时预算从约 10.33 ms 放宽到 18.67 ms,可以保留第三帧的 PTS 节奏;稳态 lead 仍是 2 ms,不固定增加两帧延迟。

NTSC 119.88 FPS 同样进入两帧预算。阈值精确设为 119.88,而不是宽泛的 119.0,因此真正的 119 FPS 自定义流仍保持一帧预算;90 FPS、30/60 FPS 的边界也不变。

验证

  • c++ -std=c++17 -Wall -Wextra -Werror nativelib/src/main/cpp/presentation_scheduler.cpp nativelib/src/test/cpp/presentation_scheduler_test.cpp -I nativelib/src/main/cpp -o /tmp/moonlight_presentation_scheduler_test && /tmp/moonlight_presentation_scheduler_test
  • npm run check
  • node hvigorw.js assembleApp --mode project -p product=default -p buildMode=debug --no-daemon(DevEco SDK 6.1 / JBR 21,BUILD SUCCESSFUL)

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

调整 PTS 演示调度器的未来提前量预算,使其根据刷新率选择半帧、单帧或更大预算,并新增 120fps、90fps 及低刷新率 burst 场景测试。

Changes

PTS 未来提前量预算

Layer / File(s) Summary
刷新率相关的预算计算
nativelib/src/main/cpp/presentation_scheduler.cpp, nativelib/src/main/cpp/presentation_scheduler.h
Configure 根据 safeFps 选择未来节奏预算,并将默认 maxFutureLeadNs_ 调整为更小的初始值。
Burst 调度行为验证
nativelib/src/test/cpp/presentation_scheduler_test.cpp
新增 120fps triple burst、90fps pair burst 和低刷新率半帧预算测试,并更新 fractional FPS 断言及测试入口。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了此次将 burst 预留空间限制到高刷新率场景的核心改动。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/scope-high-refresh-pacing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/main/cpp/presentation_scheduler.cpp`:
- Around line 21-22: Lower the kTripleBurstFps threshold from 120.0 to a value
such as 119.0 so safeFps values of 119.88 FPS enter the triple-burst budget path
while preserving the existing threshold logic for other frame rates.
🪄 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: 61f7e187-98d4-4500-b6f4-0fca324ac6b7

📥 Commits

Reviewing files that changed from the base of the PR and between 78afe56 and bf45923.

📒 Files selected for processing (3)
  • nativelib/src/main/cpp/presentation_scheduler.cpp
  • nativelib/src/main/cpp/presentation_scheduler.h
  • nativelib/src/test/cpp/presentation_scheduler_test.cpp

Comment thread nativelib/src/main/cpp/presentation_scheduler.cpp Outdated
@qiin2333
qiin2333 merged commit 2c57711 into master Jul 20, 2026
2 checks passed
@qiin2333
qiin2333 deleted the codex/scope-high-refresh-pacing branch July 20, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant