Repository navigation
obs-media-io: register the audio thread as a profiler root with its tick period (Fixes #5769) - #5774
Merged
Merged
Conversation
… (RED, Refs #5769) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ick period (Fixes #5769) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
vpacher
enabled auto-merge
November 26, 2026 09:43
Every audio thread in the test binary registers the same NULL-named profiler root, so an audio output of a parallel test overwrote the expected time between the 48 kHz and 44.1 kHz checks (Windows Rust Tests, run 45793492596: 44100 Hz roots [21333]). The test now re-runs itself alone with --exact --test-threads=1, as obs-util's isolated() does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zackees
disabled auto-merge
November 26, 2026 10:02
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 26, 2026
This was referenced Nov 26, 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.
Fixes #5769. Part of #5768 (thread priority on Linux and macOS, discussion #5458).
Change
The audio thread now registers its profiler name as a root, with the tick period as the expected time between calls (
audio_frames_to_ns(rate, AUDIO_OUTPUT_FRAMES), 21.333 ms at 48 kHz). The graphics thread already does this with its frame interval. Result: the profiler output at quit shows how regularly the audio thread mixes, in a normal OBS log on every platform. The other sub-issues of #5768 use this line to measure their effect.The mixing itself does not change: the thread makes one more profiler call before its loop.
RED → GREEN
audio_thread_registers_profiler_root_with_tick_period(media-io library harness,tests/audio/audio_io.rs). The test starts obs-util's profiler, opens an audio output at 48 kHz and at 44.1 kHz, waits for a tick, and looks for a profiler root that expects the tick period. Before the change it failed:48000 Hz: no profiler root expects 21333 us between calls (roots: [0]).In the test binary the oracle's name store is NULL, so the test finds the root by its expected time, not by its name.
profile_register_root(audio_thread_name, period)call after the name is stored. All 403 tests of the media-io harness pass. Clippy and rustfmt are clean.Tiers:
audio_io_paritycases (mixed output against the C oracle) pass unchanged.Real app
macOS build (RelWithDebInfo, M1 Max), OBS run for 40 s, then quit. Profiler output before this change: no
audio_threadline in "Time Between Calls". After:At idle on macOS, only about 17 % of the audio ticks are within ±2 % of the period. That agrees with the lateness measured in #5458 for a default-priority thread, and it is the baseline for #5771.
Not run on Linux in the real app. The code path is the same on all platforms (no platform code).
Test cost
New test: longest 0.10 s, peak RSS 8.8 MB over 25 runs. It starts no threads of its own; each
audio_output_openstarts the audio thread, one at a time.The test runs in its own child process (f269d34), as obs-util's
isolated()does. In the test binary every audio thread registers the same NULL-named root, so the audio output of a parallel test overwrote the expected time on Windows (run 45793492596:44100 Hz: no profiler root expects 23220 us between calls (roots: [21333])). The child adds one process start, about 0.1 s.Ledger
docs/features.md, Performance: "Audio thread regularity in the log".🤖 Generated with Claude Code