chore: track upstream thorvg main, keep web video - #614
Open
theashraf wants to merge 4 commits into
Open
Conversation
|
theashraf
force-pushed
the
chore/rebase-thorvg-v1.1.1
branch
from
August 28, 2026 15:37
0c66f41 to
cee64cf
Compare
Track thorvg/thorvg main directly instead of the theashraf fork. Upstream already ships video-in-image-assets, so the fork's only remaining patches were the 1s seek dead-band removal and the slot w/h fix; the crate covers the latter via normalize_image_slot and the web player now follows the upstream seek contract. Adds a remainderf stub for wasm32-unknown-unknown, which the new stroker code in tvgSwStroke.cpp calls.
Upstream keeps a 1s tolerance before seeking a video, so the web player no longer gets a target every tick. The old tracker extrapolated from a stale target and fought the element: rate oscillated between 0.5x and 1x with a hard seek every couple of seconds. The element now runs on its own clock. It plays only while ThorVG wants the layer playing and the dotLottie player is not paused, at the player's speed via playbackRate; reverse playback holds the frame between ThorVG's seeks. Speed and direction are pushed from the player on play, set_speed and every direction flip, and applied to videos opened later.
- Don't call play() on an ended element: it restarts from 0 and ThorVG's drift check then yanks it back every few frames. A clip shorter than its layer now holds its last frame until the next seek. - The warm-up play() no longer leaves the clip running while the player is stopped: a loadeddata listener pauses it unless something wants it. - Reset the load-kick counter once frames arrive and ignore seeks (Chrome drops readyState on every seek); the kick is a bare play(), not load(). - Halt videos when a non-looping animation completes and when a new animation loads; sync rate on load and when resuming from a tween. - Release the registry lock before calling into the DOM. - MediaLoader::open returns NonSupport on failure so ThorVG stops probing the other loaders with the MP4 bytes. - Unknown ThorVG result codes (new SystemError) map to Err instead of unreachable!().
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.
Pins `dotlottie-rs/deps/thorvg` to upstream thorvg/thorvg main (4f968a5f, 2026-09-05) and drops the theashraf fork.
What changed vs. the fork
Web video player
ThorVG lets the clip free-run and only seeks it when it drifts more than 1s from the animation clock. The previous tracker assumed a per-tick target and, under the dead-band, oscillated between 0.5x and 1x with a hard seek every ~2s. The element now plays on its own clock, only while ThorVG wants the layer playing and the dotLottie player is not paused, at the player's speed via `playbackRate`. Reverse playback pauses the element and relies on ThorVG's seeks.
Known limits inherited from the dead-band (to raise upstream): after a scrub or a reverse→forward switch an offset of up to 1s can persist, and reverse playback advances in ~1s steps.
Verification
Review pass (code-review, 15 findings)
Fixed: ended-clip restart loop; clip left running in the background while the player is stopped; load-kick counter accumulating across seeks; completion and load never halting videos; missing rate sync on load and tween resume; registry lock held across DOM calls; shim returning
InvalidArguments(ThorVG kept probing other loaders) →NonSupport;into_resultpanicking on the newTVG_RESULT_SYSTEM_ERROR→Err.Documented, inherent to upstream's dead-band: ~1s steps whenever the element is paused (reverse, paused scrub), and drift + periodic hard seeks when clip duration ≠ layer span (ThorVG stretches the clip over the layer).
Deferred, pre-existing: the video registry is per wasm module, not per
Player(now also carries rate);remainderfstub is hand-written (fine for ThorVG's angle use,libmcrate would make it exact).Re-verified after the fixes: fmt/test/clippy green, all three wasm bundles link clean; browser scenarios A–F pass again, plus completion halts the video and a 2s clip on a 5s layer holds its last frame with no restarts.