You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: test_async_audio_own_clock small_packets_audio_ahead_of_video_is_heard is flaky (88-89% vs >=90%) #3948
The unchanged C test test/cmocka/test_async_audio_own_clock.c:361 (small_packets_audio_ahead_of_video_is_heard) fails intermittently in both libobs builds.
Local Tier 2 Docker image, 10 runs per lane: hybrid 10/10 pass, C reference 9/10 (run 3 heard 88%, required >=90).
An earlier local hybrid run heard 89%.
So it is a timing-threshold flake, not a Rust/C parity difference. Since the C test must stay unchanged, the fix is in how/where it runs (e.g. isolation from parallel load, or a retry policy for timing tests), or a deliberate maintainer decision about the threshold.
Investigation (master 12ca3a2, Tier 2 Docker image, both libobs builds, unchanged test binary, no retries/filters):
libobs
unloaded
same-core CPU load
RUN_SERIAL + RESOURCE_LOCK
timeline prototype, loaded
C reference
17/20
20/20
20/20
20/20
hybrid Rust
18/20
18/20
19/20
20/20
Every failure is small_packets_audio_ahead_of_video_is_heard at :361 with 86-89% tone coverage against a 90% floor (healthy runs measure ~93%, so headroom is ~4%).
Likely cause (shared C and Rust behaviour, not a port difference): video updates replace source->timing_adjust with the video's system-time mapping (libobs/obs-source.c.h ~1917-1936). For an independent-clock audio source, the >MAX_TS_VAR check then re-anchors continuous audio packets to os_time - timestamp, so packet arrival jitter becomes audio placement jitter. That can reset buffered data and leave holes. rust/obs-source/src/audio_output.rs mirrors this.
Prototype: for continuous, non-reanchored packets on a clock other than video's, place them at next_audio_sys_ts_min - timestamp (keep the previous audio timeline). Discontinuities, common-clock and decoupled/unbuffered paths stay unchanged, with no ABI change. Applied to both C and Rust, it went 0/40 failing under load. RUN_SERIAL alone does not fix it (hybrid still failed 1/20).
Open questions before any landing: this changes libobs core timing behaviour relative to upstream OBS (a maintainer decision). Three existing Rust unit tests in obs-source::audio_output encode the current re-anchoring behaviour and getter-call order. Landing would need deterministic jitter/continuity tests plus differential coverage. Nothing has been committed.
Re-measured on master d8d4421a5: the flake no longer reproduces.
Same Tier 2 image and build as CI (both libobs builds, the unchanged test binary, no retries). Each run was pinned to its own CPU with its own Xvfb display. In the "loaded" runs, a busy loop ran on the same CPU as the test.
libobs
ctest (full suite, then --repeat until-fail:20)
unloaded
same-CPU load
more runs
C reference
21/21
20/20
20/20
40/40
hybrid Rust
21/21
20/20
20/20
40/40
Every run measured 93 % tone coverage in all four coverage cases, also small_packets_audio_ahead_of_video_is_heard, and also under load. On 11-08 the failing runs measured 86-89 %, against healthy runs at about 93 %.
The fix is most likely #4049 (merged 11-08 17:37, after the investigation above at 12ca3a2d2). For audio on a clock of its own, it keeps a timing of its own and does not follow the video's timing. That is the change the prototype above made. #4202 (11-09) then re-anchors that own timing when a fast sender's audio runs too far ahead.
One other observation, in a case this issue does not cover: fast_sender_clock_does_not_build_up_delay (added in #4202) failed once in 103 hybrid runs (0 in 103 C runs). Its marker delays were 0 18 36 54 915 936 954 1827 1845 ms: two jumps of about 0.9 s, not a slow build-up. All other runs stayed at 55 ms or less. One failure does not show whether this is a Rust difference or timing. I'll keep watching it and file an issue if it shows again.
Closing as fixed by #4049: own-clock audio now has independent timing in both C and Rust, while the original small-packet >=90% assertion remains. The interleaved RED/GREEN evidence on #4049 and the later measurements recorded above on d8d4421 support the fix in both backends, including under load. This closure is based on the inspected implementation and existing reported/runtime evidence, not a new coordinator test run. The separate one-off fast-sender marker-delay observation in the fifth case added by #4202 remains unclassified; #4182 already tracks smooth drift correction without audible steps. No threshold reduction, retry policy or permission to modify existing C tests is implied.
Activity
zackees commentedon Nov 8, 2026
Another occurrence: small_packets_audio_ahead_of_video_is_heard failed in Rust Tier 2 Linux on PR #3957, job https://github.com/obs-rust/obs-studio/actions/runs/42449585885/job/128637125701 (1 of 783 failed). Re-ran the failed jobs.
zackees commentedon Nov 8, 2026
Third occurrence in a day: small_packets_audio_ahead_of_video_is_heard (test_async_audio_own_clock.c:361) failed in Rust Tier 2 Linux (tests ON) on PR #4007, job https://github.com/obs-rust/obs-studio/actions/runs/42462788981/job/128678003964 (1/788). Also hit #3989 and #3957 today. Re-ran the failed jobs. This is now the most frequent cause of a red Tier 2 run on test-registration PRs.
zackees commentedon Nov 8, 2026
Investigation (master 12ca3a2, Tier 2 Docker image, both libobs builds, unchanged test binary, no retries/filters):
Every failure is small_packets_audio_ahead_of_video_is_heard at :361 with 86-89% tone coverage against a 90% floor (healthy runs measure ~93%, so headroom is ~4%).
Likely cause (shared C and Rust behaviour, not a port difference): video updates replace source->timing_adjust with the video's system-time mapping (libobs/obs-source.c.h ~1917-1936). For an independent-clock audio source, the >MAX_TS_VAR check then re-anchors continuous audio packets to os_time - timestamp, so packet arrival jitter becomes audio placement jitter. That can reset buffered data and leave holes. rust/obs-source/src/audio_output.rs mirrors this.
Prototype: for continuous, non-reanchored packets on a clock other than video's, place them at next_audio_sys_ts_min - timestamp (keep the previous audio timeline). Discontinuities, common-clock and decoupled/unbuffered paths stay unchanged, with no ABI change. Applied to both C and Rust, it went 0/40 failing under load. RUN_SERIAL alone does not fix it (hybrid still failed 1/20).
Open questions before any landing: this changes libobs core timing behaviour relative to upstream OBS (a maintainer decision). Three existing Rust unit tests in obs-source::audio_output encode the current re-anchoring behaviour and getter-call order. Landing would need deterministic jitter/continuity tests plus differential coverage. Nothing has been committed.
vpacher commentedon Nov 10, 2026
Re-measured on master
d8d4421a5: the flake no longer reproduces.Same Tier 2 image and build as CI (both libobs builds, the unchanged test binary, no retries). Each run was pinned to its own CPU with its own Xvfb display. In the "loaded" runs, a busy loop ran on the same CPU as the test.
--repeat until-fail:20)Every run measured 93 % tone coverage in all four coverage cases, also
small_packets_audio_ahead_of_video_is_heard, and also under load. On 11-08 the failing runs measured 86-89 %, against healthy runs at about 93 %.The fix is most likely #4049 (merged 11-08 17:37, after the investigation above at
12ca3a2d2). For audio on a clock of its own, it keeps a timing of its own and does not follow the video's timing. That is the change the prototype above made. #4202 (11-09) then re-anchors that own timing when a fast sender's audio runs too far ahead.I suggest closing this as fixed by #4049.
One other observation, in a case this issue does not cover:
fast_sender_clock_does_not_build_up_delay(added in #4202) failed once in 103 hybrid runs (0 in 103 C runs). Its marker delays were0 18 36 54 915 936 954 1827 1845ms: two jumps of about 0.9 s, not a slow build-up. All other runs stayed at 55 ms or less. One failure does not show whether this is a Rust difference or timing. I'll keep watching it and file an issue if it shows again.zackees commentedon Nov 11, 2026
Closing as fixed by #4049: own-clock audio now has independent timing in both C and Rust, while the original small-packet >=90% assertion remains. The interleaved RED/GREEN evidence on #4049 and the later measurements recorded above on d8d4421 support the fix in both backends, including under load. This closure is based on the inspected implementation and existing reported/runtime evidence, not a new coordinator test run. The separate one-off fast-sender marker-delay observation in the fifth case added by #4202 remains unclassified; #4182 already tracks smooth drift correction without audible steps. No threshold reduction, retry policy or permission to modify existing C tests is implied.