Skip to content

test(cmocka): anchor the group-hide program meter to the mix's clock (#838) - #3000

Merged
zackees merged 2 commits into
masterfrom
test/838-group-hide-audio-window
Oct 30, 2026
Merged

zackees merged 2 commits into
masterfrom
test/838-group-hide-audio-window

Conversation

@zackees

@zackees zackees commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What

test_group_hide_transition_audio's program_level() pinned its measurement window to the wall clock and then slept a fixed 1000 ms. On a loaded machine the window closes before the audio thread has mixed anything, and all four cases fail with no program audio was mixed — a failure in the test's own meter, not in the code under test (#838, first seen 2026-10-15 on a shared host, reproduced with ENABLE_RUST_LIBOBS=OFF too).

Part 1 of the decided three-PR sequence on #838 (test-side determinism, per the maintainer's Decided: comment). test_async_delay_audio listen() and test_vlc_playlist_gap follow in their own PRs.

How

The window keeps both of its original anchors — the clock at the request and 400 ms of mix — so it measures exactly the audio it measured before. Only the wait changes:

  • program_level() arms the meter, records how far the mix has got (last_ts), and waits for the mix to reach the window's end on the mix's own clock, bounded at 5 s, instead of sleeping 1000 ms and hoping the audio thread ran;
  • raw_audio() remembers the newest timestamp it has mixed while the meter is armed.

Every assertion and threshold is unchanged, including no program audio was mixed when the mix never delivers. A starved machine now delays the measurement instead of emptying it.

An earlier attempt on this branch opened the window on the first frame that arrived. The mix's own buffering then put a finished 300 ms show transition inside the window (after showing the group again: program level 0.89 of the tone), which the 100-repeat run caught at 14/100 — that is why the anchors are unchanged.

Evidence

Test-timing only: no product code, no public header, no other C test touched (git show --stat is this one file).

Local Tier 2 harness, uv run --no-project rust/tools/linux-validate/run.py --repeat 100 --tests test_group_hide_transition_audio, on a host at load average 34 (16 cores), so the fix is measured under exactly the starvation that produced the flake:

== [OFF] ctest
100% tests passed, 0 tests failed out of 623
== [OFF] ctest --repeat until-fail:100 -R test_group_hide_transition_audio
100% tests passed, 0 tests failed out of 1      (100/100 repeats)
== [ON] ctest
100% tests passed, 0 tests failed out of 623
== [ON] ctest --repeat until-fail:100 -R test_group_hide_transition_audio
100% tests passed, 0 tests failed out of 1      (100/100 repeats)

No ***Failed line anywhere in the run; ENABLE_RUST_LIBOBS=OFF and ON both hold, and the unmodified 623-test suite still passes in both modes.

PR CI: Fast Gate ✅, Tier 2 Linux build/tests OFF+ON ✅, CI Gate ✅.

Refs #838

…838)

program_level() pinned its 400 ms window to the wall clock and then slept
1000 ms, so on a starved machine the window closed before the audio thread
mixed anything and all four cases failed with "no program audio was mixed".

Open the window on the first frame mixed after the request and close it
after 400 ms of mixed audio, waiting on that clock with a bounded timeout.
Every assertion and threshold stays.
@zackees
zackees force-pushed the test/838-group-hide-audio-window branch from b40bb20 to 7709bbc Compare October 30, 2026 05:47
… sleep (#838)

The window keeps its original anchors (the clock at the request, 400 ms
long), so it measures the same audio as before. What changes is that
program_level() waits for the mix to reach the window's end on the mix's
own clock, bounded at 5 s, instead of sleeping 1000 ms and hoping the audio
thread had run: a starved machine delays the measurement instead of
emptying it.

The first attempt anchored the window on the first frame that arrived; the
mix's own buffering then put a finished 300 ms show transition inside the
window (0.89 of the tone) and the 100-repeat run caught it at 14/100.
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Oct 30, 2026
@zackees
zackees marked this pull request as ready for review October 30, 2026 06:46
@zackees
zackees added this pull request to the merge queue Oct 30, 2026
Merged via the queue into master with commit 713cd46 Oct 30, 2026
39 checks passed
@zackees
zackees deleted the test/838-group-hide-audio-window branch October 30, 2026 06:57
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Done in obs-rust Multiview Oct 30, 2026
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.

1 participant