Repository navigation
fix: seek every motion recording when pausing realigns them - #5212
Conversation
Pausing read the furthest recording's time and seeked only the recordings behind it. Chromium truncates a seek target to whole microseconds, so for about one playback position in fifty (0.5004 s seeks to 0.500399 s) the seeked recordings landed a microsecond behind the unseeked leader. lf-motion now seeks every recording once any is off the clock's time, so each takes the same native rounding; a transport already aligned still seeks none. The new step in the recordings test pauses the leading recording natively at a position the truncation moves, then pauses the transport, and requires the recordings to agree exactly. It failed before this change (0.5045 == 0.504499) and passes after it. Closes #5169
|
@leaf-agent The fix looks narrow, but the new regression can pass without reaching the rounding-sensitive position. In
|
The regression step searched up to 500 native pauses for a position the seek truncation moves, and fell through to the equality assertion when it found none, where the old seek loop also passes. The search is now a `wait_for_function`, so it takes the suite's Playwright deadline and fails the test when the precondition never holds. Control: with main's lf-motion.js the step fails three runs out of three (4.0623 == 4.062299, 2.0136 == 2.013599, 1.0006 == 1.000599); with the fix it passes three out of three.
|
Fixed in 945272e. The search for a truncating position is now a Old-code control: with main's |
Pausing two motion recordings could leave them a microsecond apart. On pause,
lf-motionreads the furthest recording's time and seeks only the recordings behind it. Chromium truncates a seek target to whole microseconds, so for about one playback position in fifty the seeked recording lands a microsecond behind the leader, which was never seeked: a leader at 0.5004 s pulls the trailing recording to 0.500399 s. That is the0.5004 == 0.500399failure in #5169. Now, once any recording is off the clock's time,#seekVideosseeks all of them, so each gets the same native rounding. A transport whose recordings already agree still seeks none, and the test's check that playback never seeks per frame still passes.This is the same truncation #4419 found for a seek requested by the author. That PR widened the transport-versus-video tolerance. This change fixes the transport itself, and the exact agreement between recordings holds again without a wider tolerance.
Verification. A new step in
test_motion_recordings_share_native_playback_and_a_sticky_transportpauses and resumes the leading recording natively until it stops on a position the truncation moves, then pauses the transport and asserts the two recordings agree exactly. That search is await_for_functionunder the suite's deadline, so the test fails rather than passes when it never reaches such a position. With main'slf-motion.jsthe step failed three runs out of three (4.0623 == 4.062299,2.0136 == 2.013599,1.0006 == 1.000599); with the fix it passed three out of three. The browser type check (tsc -p browser/types) is clean.Closes #5169 — automated triage