Skip to content

test: Bound the playing-seek media time by the time that passed - #1766

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/media-seek-playing-wallclock
Oct 22, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/media-seek-playing-wallclock

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1765

What and why

playing_seek_between_keyframes (from #479) seeks while the video plays, waits for the first frame, then reads the media time. It required that time to be at most 500 ms past the target. The video keeps playing while the test waits, so a slow runner fails it even when the seek is right. macOS Tier 2 on #1721 (run 39726924020, attempt 2, job 119704244848):

playing seek to 4500 ms: first frame 135, media time 5100 ms
playing seek: seek to 4500 ms reports a media time of 5100 ms

Frame 135 is the target frame. The upper bound is now the target plus the real time between the seek and reading the media time, plus the existing two-frame slack (TIME_SLACK_MS). The first-frame check and the lower bound are unchanged, and a media time that runs ahead of real playback still fails. The diagnostic line now also prints the elapsed time.

Test expectation change (maintainer sign-off): this widens one upper bound in an existing test from a fixed 500 ms to the measured elapsed time + two frames. It's our own test; nothing else in it changes.

RED → GREEN

  • RED (local, not committed): a 700 ms os_sleep_ms() injected between wait_first_frame() and media_playback_get_current_time(), which simulates the slow runner. The old bound fails: seek to 4500 ms reports a media time of 5266 ms.
  • GREEN: 2f8c2c3 with the same injected sleep passes 7/7 (media time 5266 ms, 740 ms after the seek).
  • Without the sleep: 20/20 runs on C libobs (OBS_LIBOBS_BACKEND=C), 20/20 on hybrid Rust libobs, 10/10 on libobs-c-reference. uv run ci/local_gate.py --lane lint is ok.

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it (test: playing_seek_between_keyframes fails on slow runners (fixed 500 ms bound) #1765)
  • Characterization test (if the unit had none), then RED, then GREEN commits (test-only fix: RED shown locally with an injected delay)
  • User-visible change: its line in docs/features.md is added or updated (not applicable: test only)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): none
  • Intentional differences from C listed in the parity test header and rust/README.md (ports): not a port

AI note: Claude Code (Claude Opus 5.5) wrote the change, the commit message and this text under the submitter's direction, and ran the tests above on the submitter's machines.

playing_seek_between_keyframes seeks while the video plays, waits for
the first frame, then reads the media time and required it to be at
most 500 ms past the target. The video keeps playing while the test
waits, so a slow runner that takes longer than that to show and report
the first frame failed it although the seek was right (macOS Tier 2:
first frame 135, the target frame, but media time 5100 ms for a
4500 ms seek).

The upper bound is now the target plus the real time between the seek
and reading the media time, plus the existing two-frame slack. The
first-frame check and the lower bound are unchanged, and a media time
that runs ahead of real playback still fails.

With a 700 ms sleep injected before reading the media time, the old
bound fails (5266 ms for 4500 ms) and the new one passes (740 ms
elapsed).

Fixes obs-rust#1765
@rdoupe
rdoupe requested a review from zackees as a code owner October 22, 2026 08:32
@zackees
zackees added this pull request to the merge queue Oct 22, 2026

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks right. The upper bound is now the wall time that passed since the seek, plus slack, instead of a fixed 500 ms. The lower bound and the frame check are unchanged, so it still catches a seek that lands short or shows the wrong frame. This fixes a timing flake and doesn't loosen what the port has to do. Queued.

Merged via the queue into obs-rust:master with commit 91f239e Oct 22, 2026
25 checks passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 22, 2026
…s-rust#1775)

obs-rust#1766 bounded the media time read after a playing seek by the target
plus the real time that passed plus two frames. A playing source
decodes ahead, so the time it reports can run ahead of the frame it
shows, and on a fast runner that exceeds two frames: macOS Tier 2 saw
4666 ms for a 4500 ms seek 97 ms after it (limit 4663 ms), with the
right first frame. Locally it runs 66 ms ahead after 40 ms.

Keep both allowances: the elapsed time for a slow runner, plus the
500 ms the test allowed before obs-rust#1766 for running ahead. The first-frame
check and the lower bound are unchanged.

Fixes obs-rust#1774
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test: playing_seek_between_keyframes fails on slow runners (fixed 500 ms bound)

2 participants