Repository navigation
test: Run the output stream delay end to end through libobs - #1578
Merged
Merged
Conversation
test_output_delay compiles obs-output-delay.c.h into itself, so no test set a stream delay through the libobs that ships. With the Rust delay core broken, every end-to-end test still passed against libobs-with-rust; only the Tier 3 parity tests caught it. test_output_delay_e2e registers an audio encoder and an encoded output, feeds the encoder from a real-time audio thread, and sets one-second delays. It checks that packets reach the output at least the delay after they were encoded, in order and without gaps; that the output's start() and stop() run after the delay, the stop with the time it was asked for; obs_output_get_active_delay(); that a force stop skips the delay and drops the queue; and both reconnect paths: with OBS_OUTPUT_DELAY_PRESERVE the queue is held and the delay grows by the outage, without it the packets due during the outage are dropped. The checks are orderings and lower bounds only, so a slow runner cannot fail them. Refs obs-rust#1546
zackees
enabled auto-merge
October 21, 2026 00:12
This was referenced Oct 21, 2026
This was referenced Oct 21, 2026
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 #1546 (follow-up to #1567: an end-to-end test of the ported delay)
What and why
#1567's deliberate-break check showed that no test set a stream delay through the libobs that ships.
test_output_delaycompilesobs-output-delay.c.hinto itself, so with the Rust core broken, every end-to-end test still passed againstlibobs-with-rust. Only the Tier 3 parity tests caught the break. This PR addstest/cmocka/test_output_delay_e2e.c, which drives a real encoded output with a delay through real libobs. It is test-only: no change to libobs, to Rust code or to an existing test.obs_startup(), then an audio encoder and an audio-only encoded output, both registered in the test (liketest_output_interleave_restart). A real-timeaudio_output_open()thread feeds the encoder silence, and each packet's encode time is recorded. No video, no graphics, no network. On Linuxobs_startup()needs a display, so the test is wrapped inxvfb-runthe waytest_audio_controlsis, and it skips without a display.tests.d/test_output_delay_e2e.cmakefragment. No Cargo C-test manifest entry: the native driver runs without a display, and no manifest test callsobs_startup().delayed_start_packets_and_stop: the output'sstart()runs at least 1 s afterobs_output_start(), and not before it returns.obs_output_get_delay()is 1 andobs_output_get_active_delay()is 0 before the start, then 1. Every packet reaches the output at least 1 s after it was encoded, in pts order from the first one, with none missing, and none beforestart().obs_output_stop()signalsstoppingat once. The output'sstop()runs at least 1 s later, with the time the stop was asked for. Every packet queued before the stop was sent; none encoded after it was. Once the output deactivates, the active delay is back to 0.force_stop_skips_delay:obs_output_force_stop()runsstop()before it returns (ts 0). The output deactivates, and the queued second of packets is dropped, not sent.no_delay_passes_through: with no delay,start()andstop()run insideobs_output_start()andobs_output_stop(), and packets pass straight through.preserve_holds_queue_through_reconnect: withOBS_OUTPUT_DELAY_PRESERVE, the output reportsOBS_OUTPUT_DISCONNECTEDitself (no network) and reconnects after a 2 s retry wait. Packets encoded before the outage reach the output after it, no packet goes missing, and the active delay grows to at least 2 s.no_preserve_drops_due_packets_through_reconnect: without the flag, during a 1 s retry wait, packets keep coming due and are dropped. The output receives a gap, still in order, and the active delay stays at 1.RED → GREEN
test: Run the output stream delay end to end through libobs.ENABLE_RUST_LIBOBS=OFF)ENABLE_RUST_LIBOBS=ON)rust/obs-output/src/delay.rs), each rebuilt intolibobs-with-rustand run against it (mode ON): 6 of 8 fail the test.>=for the strict>in the pop, and one pop per call instead of the loop. Neither shows on a real clock. The first differs only when an entry's age equals the delay to the nanosecond. The second only lags each delivery by one packet interval. The deterministic Tier 1/2/3 tests (test clock) cover both.ENABLE_RUST_LIBOBS=OFF)ENABLE_RUST_LIBOBS=ON)No test was skipped or failed to run.
test_output_delay_e2etakes 9.6 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. The test is portable C with no host conditionals. It uses only public libobs API (
obs.h,util/platform.h,util/threading.h), and runs wheretest_output_start_twiceruns.Checklist
masterdocs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): not applicable