Repository navigation
test: Run the output interleaver end to end through libobs - #1606
Merged
Merged
Conversation
obs-rust#1603 ports obs-output-interleave.c.h to rust/obs-output, and its deliberate-break check showed that the tests run through a real libobs catch only the catch-up limit (test_output_interleave_restart). test_output_interleave compiles the C file into itself, so with the premature prune made non-strict (>=) or the video-before-audio insertion rule removed in the Rust core, every real-libobs test still passed against libobs-with-rust; only Tier 3 caught them. test_output_interleave_e2e drives an encoded output with one video and two audio tracks, all registered in the test, through obs_startup() and real core video, and feeds the media by hand as the restart test does, so nothing depends on the wall clock. It checks what the output's encoded_packet callback receives: the first packet is a video keyframe at dts 0 and each audio track starts after it, near 0; the dts never decrease across the tracks, with video before audio at an equal dts; audio exactly one frame after the first keyframe keeps it, and audio two frames after drops it, so the output starts at the next keyframe (as test_output_interleave characterizes); and the same output, stopped, receives nothing and starts afresh the same way. About 2 s. Refs obs-rust#1594
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.
Refs #1594 (follow-up to #1603: an end-to-end test of the ported interleaver)
What and why
#1603's deliberate-break check showed that the tests run through the libobs that ships catch only the interleaver's catch-up limit (
test_output_interleave_restart).test_output_interleavecompilesobs-output-interleave.c.hinto itself, so it characterizes the C source only. With the premature prune made non-strict (>=) or the video-before-audio insertion rule removed in the Rust core, every real-libobs test still passed againstlibobs-with-rust; only Tier 3 caught them. This PR addstest/cmocka/test_output_interleave_e2e.c, which drives a real encoded output with one video and two audio tracks through real libobs. It is test-only: no change to libobs, to Rust code or to an existing test.obs_startup()with real core video, then a video encoder, two audio encoders and an encoded multi-track output (OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_MULTI_TRACK), all registered in the test. The media is fed by hand, as intest_output_interleave_restart: each step submits one audio block (one packet from each audio encoder, with a dts the test picks) and then one video frame (a keyframe every third frame, the frame number in the payload), and waits until the encoders and the output have handled it. Audio encoders paired with the video start at the video's start time, so an audio packet's dts sets its place relative to the first video frame. The output'sencoded_packet()records what it receives.tests.d/test_output_interleave_e2e.cmakefragment liketest_output_interleave_restart's: Linux withlibobs-opengl, skip code 77 without a display (CI runs ctest underxvfb-run).starts_on_keyframe_and_interleaves: audio and video start together. The output starts at frame 0. Each audio packet is queued before the video frame of the same dts, so the insertion order shows.audio_one_frame_late_keeps_keyframe: the first audio is exactly one frame (20 ms) after the first keyframe. That is not premature (the prune is strict): the output starts at frame 0 and the audio is offset to 0 as well.late_audio_starts_at_next_keyframe: the first audio is two frames after the first keyframe. Astest_output_interleavecharacterizes (not endorsed), the keyframe is dropped and the output starts at the next keyframe, frame 3, with every track at 0.stop_and_restart: a capture, thenobs_output_stop()until the output deactivates. Media submitted after that reaches nothing. The same output then starts again with late audio and starts at frame 3 at dts 0: the start rules and the offsets apply to the new capture, not the old one.RED → GREEN
test: Run the output interleaver end to end through libobs.ENABLE_RUST_LIBOBS=OFF)ENABLE_RUST_LIBOBS=ON)Since #1603 merged, the
libobs-with-rustcolumn runs the Rust interleaver.rust/,libobs/andtest/are identical to master's since it merged), each mutant of the Rust core (rust/obs-output/src/interleave.rs) was rebuilt intolibobs-with-rustand the test was run against it (mode ON). Both mutants fail it, whiletest_output_interleave_restartstill passes:diff >= duration_usecfor the strict>inpremature_prune:audio_one_frame_late_keeps_keyframefails (the output starts at frame 3, not 0); the other 3 cases pass. 2/2 runs.insert_position: all 4 cases fail. Three see audio before video at an equal dts;late_audio_starts_at_next_keyframesees audio as the first packet. 2/2 runs.libobs.ENABLE_RUST_LIBOBS=OFF)ENABLE_RUST_LIBOBS=ON)No test was skipped or failed to run.
test_output_interleave_e2etakes 1.65-1.68 s inside the parallel suite.uv run ci/local_gate.py --lane lint: passed. clang-format and gersemi are clean on the new files.Windows/macOS: not built there. Like
test_output_interleave_restart, the test is registered on Linux only (it loadslibobs-openglfor core video). It uses only public libobs API (obs.h,media-io/video-frame.h,util/threading.h).Checklist
masterdocs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): not applicable