Repository navigation
Conversation
mfazekas
force-pushed
the
fix/android-idle-frame-loops
branch
from
October 28, 2026 08:41
0bfdca3 to
e787746
Compare
mfazekas
force-pushed
the
fix/android-frame-pacer
branch
from
October 28, 2026 08:41
eb2c743 to
45fa68f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Pending frame callbacks are not rescheduled or canceled when the cap or playback state changes, causing delayed updates after uncapping and animation jumps after pause/resume.
2 open issues
What changed in this PR
This PR refines the new Android backend’s frame-rate caps on top of #416’s idle-loop changes, targeting accurate pacing for non-divisor caps and fewer unnecessary frame callbacks.
Changes:
- Adds a frame pacer modeled on rive-android’s internal implementation.
- Uses delayed callbacks and resets pacing alongside the render timebase.
- Adds a 45 fps option to demonstrate non-divisor pacing.
| File | Description |
|---|---|
example/src/reproducers/FrameRateCap.tsx |
Adds the 45 fps example option. |
android/src/new/java/com/rive/RiveReactNativeView.kt |
Integrates pacing, delayed callbacks, and timing resets. |
android/src/new/java/com/rive/RiveFramePacer.kt |
Tracks target render times and calculates callback delays. |
Review effort: Balanced
mfazekas
force-pushed
the
fix/android-frame-pacer
branch
from
October 29, 2026 05:44
45fa68f to
59d0768
Compare
mfazekas
force-pushed
the
fix/android-frame-pacer
branch
from
October 29, 2026 05:55
59d0768 to
752d446
Compare
The frameRate cap compared each vsync against the last drawn frame with a 4 ms tolerance, so a cap that does not divide the refresh rate came out low (60 fps on a 90 Hz display rendered at 45), and every skipped vsync still cost a frame callback. Use a copy of rive-android's internal RiveFramePacer, which tracks the next due frame time, and post the next frame callback delayed until close to that time, as the Rive composable does.
mfazekas
force-pushed
the
fix/android-frame-pacer
branch
from
October 29, 2026 06:05
752d446 to
b7f2ffa
Compare
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.

Stacked on #416.
The
frameRatecap compared each vsync against the last drawn frame with a 4 ms tolerance, so a cap that doesn't divide the refresh rate came out low (60 fps on a 90 Hz display rendered at 45), and every skipped vsync still cost a frame callback. This replaces it with a copy of rive-android's internalRiveFramePacer, which tracks the next due frame time, and posts the next frame callback delayed until shortly before it, as theRivecomposable does.On a 60 Hz emulator (release build, per 10 s): a 45 fps cap went from 293 to 449 draws, and a 15 fps cap from 600 to 294 frame callbacks. 30 fps on 60 Hz still wakes on every vsync, the same as upstream, because the pacer's early-wake margin lands on the vsync before the target. The Frame Rate Cap example page gets a 45 fps option to show the non-divisor case.