Repository navigation
test: The gif and join-keyframe tests judge playback, not the timing - #1001
Merged
Merged
Conversation
Fails, every run: video_once_after_last_frame_held ("the last frame was
shown for only 1 output frame(s)") and real_x264_video_thread_behind
("-6 frames", outside +-JOIN_FRAMES).
test_media_gif_last_frame: libobs hands a new raw video callback one
frame it rendered before the callback was added, so each case's
recording can start with the last picture of the case before.
check_last_frame_held judges the first run of the clip's last frame it
finds, and when the looping case before happens to end on that frame
(timing decides which), that one stale output frame is what it judges.
The new case plays the video once more right after a run that ended on
its last frame, so the stale frame is always the last frame.
test_encoder_join_keyframe: the real_ cases reckon the frame the
recording joined at from the wall clock, but an encoder's pts counts
the frames the video thread gave it. When that thread falls behind (a
slow encoder such as AOM AV1, or a busy host), the two part. The new
case keeps the video thread busy for two frame intervals per frame
before the recording joins x264.
Refs obs-rust#938.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_media_gif_last_frame failed under load with "the last frame was shown for only 1 output frame(s)" in video_once_shows_every_frame. That frame was not the clip's: libobs hands a new raw video callback one frame it rendered before the callback was added, so the recording can start with the last picture of the case before, and the looping case before ends on the clip's last frame when timing has it so (a startup hitch of 100-150 ms is enough). check_last_frame_held judged the first run of that frame it found. check_order already leaves out pictures before the clip's first frame; it now also returns the run that showed the clip's last frame, and check_last_frame_held judges that run. The media playback is unchanged: the clip's own last frame was held for 4-5 output frames in each of those runs. test_encoder_join_keyframe's real_ cases reckoned the frame the recording joined at from the wall clock since the replay buffer started. The encoder's pts counts the frames the video thread gave it, which falls behind the wall clock when that thread is slow (AOM AV1 under load), so the check failed while the recording still got a keyframe made from the frame the encoder had at the join. The join is now reckoned from the frames the video thread had handed out since the encoder started (video_output_get_total_frames), read just before and just after the recording starts. Both still fail as before when the fix they guard is undone: with mp_media_hold_last_frame() disabled, every one-shot case shows 8 of 10 frames. Fixes obs-rust#938. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zackees
enabled auto-merge
October 16, 2026 06:11
5 of 6 tasks
zackees
added a commit
that referenced
this pull request
Oct 17, 2026
#1150 had test_encoder_join_keyframe and test_media_gif_last_frame reserve half the -j8 slots, from #938's report that they failed under -j8. #1001 already fixed both: the gif check judged a stale frame libobs hands a new raw video callback, and the join-keyframe cases reckoned the join frame from the wall clock instead of the frames the video thread delivered. Both passed 6 of 6 repeats together, unreserved, next to the other libobs C tests looping at -j6 on a host at load 12-17.
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.
Fixes #938
What and why
Both tests in #938 are ours:
test_media_gif_last_framecame with #306,test_encoder_join_keyframewith #598. Under load, neither the media playback nor the encoder misbehaves. Each test has a check that load can trip while the behaviour it guards is fine. Both checks now look at the behaviour itself, and each still fails when the fix it guards is undone. NoRUN_SERIAL, no wider tolerances.test_media_gif_last_frame(video_once_shows_every_frame)obs_add_raw_video_callback). So each case's recording can start with the last picture of the case before.video_once_shows_every_frameruns after the looping case. That case plays for a fixed 2.6 s, so which frame it ends on depends on timing: normally frame 7 (one-shot video: 7x1 0x8 1x3 … 9x5). A 100-150 ms render hitch when a clip starts moves it to frame 9 (one-shot video: 9x1 0x8 1x3 … 8x3 9x5).check_last_frame_heldjudged the first run of frame 9 it found: that one stale output frame. The clip's own last frame was held for 4-5 output frames in every such run.check_orderalready skipped pictures before the clip's first frame. It now also returns the run that showed the clip's last frame, andcheck_last_frame_heldjudges that run.-j8, the media thread delivered every frame within 1 ms of its due time, libobs showed every frame 133 ms after it was delivered, no output frames lagged, and the clear came 266-268 ms after the last frame, as bug: media-playback: non-looping media (e.g. a GIF) drops its last frames (upstream #10425) #306 intends.test_encoder_join_keyframe(real_aom_av1)real_cases reckoned the frame the recording joined at from the wall clock since the replay buffer started. The encoder's pts counts the frames the video thread gave it.-6 frames) while the recording still got its keyframe from the frame the encoder had when it joined (+0/+1counted in frames).video_output_get_total_frames()(frames the video thread handed out since the encoder started), just before and just afterobs_output_start(). The first packet must lie withinJOIN_FRAMESof that range. The next scheduled keyframe is still 300 frames away.Measured (16-core host, private Xvfb, system
libobs-openglmasked, TMPDIR unset)The original flake does not show up on this host from CPU load alone.
test_media_gif_last_frameon master: 0/20 alone, 0/20 and 0/10 with 16 and 48 busy loops, and it passed in 5 full ctest-j8runs (2 of them with 32 busy loops). A render hitch when the clip starts (the test holds the graphics lock for N ms when the first frame arrives; local harness, not committed) reproduces it:video_once_shows_every_frame)test_media_gif_last_frameon this branch is also 0/10 alone in each lane.test_encoder_join_keyframeon this branch: 0/10 alone in each lane and 0/10 with 32 busy loops; the new slowed-video-thread case fails 10/10 with the old check. The new case adds about 2 s (11.5 s in all).The fixes they guard
mp_media_hold_last_frame()disabled (bug: media-playback: non-looping media (e.g. a GIF) drops its last frames (upstream #10425) #306 undone): all three one-shot cases fail, 5/5 runs ("only 8 of 10 frames were shown before playback ended").request_keyframenot called on join (obs-ffmpeg: Make a keyframe when an output joins a running encoder #598 undone): everyreal_case andjoining_output_gets_a_keyframe_soonfail (no first packet within 3 s), 2/2 runs.Not changed here
test_texture_encoder_raw_formatcan hang Tier 2:run_in_child()forks after libobs has started its threads, the child can deadlock on the hotkey mutex inobs_hotkeys_context_release(), and the parent waits with no timeout. Seen once in the Rust lane at-j8(killed after 27 min). Not changed here; worth its own issue.RED → GREEN
test: The gif and join-keyframe tests fail on a busy host (RED).test_media_gif_last_frame: new casevideo_once_after_last_frame_heldplays the video once with "Show nothing when playback ends" off (it ends holding frame 9), then once with it on. It fails every run (20/20): "the last frame was shown for only 1 output frame(s)", judged on the stale9x1that opens the recording. The other 3 cases pass.test_encoder_join_keyframe: new casereal_x264_video_thread_behindkeeps the video thread busy for two frame intervals per frame for the 500 ms before the recording joins x264. It fails every run (10/10) with-6 frames. The other 8 cases pass.test_media_gif_last_frame4/4 cases andtest_encoder_join_keyframe9/9 cases withENABLE_RUST_LIBOBSOFF and ON. Full ctest at-j8(private Xvfb, systemlibobs-openglmasked, TMPDIR unset): C lane 254/254, Rust lane 254/254. Skips: onlyopen_crashes_without_obs_coreandtest_startup_shutdown_cycles's stress case, as on master. An earlier-j8run of the C lane, made while the Rust lane was building at-j8, gave 253/254:test_pulse_monitor_devicefailed once, and both tests here passed with every case run. An earlier Rust-lane run gave 252/254:test_audio_iofailed, andtest_texture_encoder_raw_formathung in a forked child (a separate issue; see below). Both pass 3/3 alone and are not touched here. clang-format 22.1.3, gersemi 0.25.0 andci/test_registration.pyclean.Checklist
master-W..., ratchets): noneAI note: Claude Code (Claude Opus 5.5) wrote the code, the tests, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.
🤖 Generated with Claude Code