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_delay_audio's tone breaks under load in the asan job #3368
tone_continuous_with_3s_video_delay fails now and then in the asan job at test/cmocka/test_async_delay_audio.c:466:
video delay 3000 ms: the tone was broken up 1 times in 4000 ms
It happened in a serial nightly too (41203573843), so it isn't only other tests competing for the CPU. ASan's slowdown is enough. The test has the timing resource lock since #3290.
What to do
The same class as #838 (real-time audio tests lose audio under load). Make the test independent of real time where it can be: drive the audio clock instead of sleeping, or measure the break from timestamps, not from wall-clock gaps. If a break is a real audio dropout in OBS, fix that.
Then its entry goes from the sanitizer harness's known list (kind flaky, #3290).
Findings so far: this looks like a real audio dropout in libobs, not a test that runs out of real time.
Reproduced with the asan build through the sanitizer harness (run_one_test, so ASAN_OPTIONS=...:fast_unwind_on_malloc=0), pinned to 4 cores with load: 2 of 8 runs fail, both in the first case, tone_continuous_with_3s_video_delay, as in CI.
An instrumented copy of the test (local only) recorded how late av_thread hands each packet to obs_source_output_audio():
Run
Producer late, at most
Samples heard
Loud samples
Breaks
failing
0.0 ms during the 4 s window (0.8 ms at most in the run)
191488
102602
1
failing
same
191488
105011
2
passing (6 runs)
same
191488 to 192512
119683 to 120323
0
So every packet arrives on time and the mix keeps producing samples, but in a failing run about 15000 to 18000 fewer samples are loud: roughly 300 to 370 ms of the tone is missing from the mix. The log shows OBS's INFO lines but no "adding ... audio buffering" and no timestamp message in that case.
That points at the audio timing path that upstream obsproject/obs-studio#13830 is about (placing the source's audio by the delayed video's timing, timing_adjust against MAX_TS_VAR), which a slow run (the harness option makes this build about 4 times slower) seems to reach again, only right after startup with the 3 s delay. Next step is to instrument that path (timing resets, timing_adjust, the audio placement) in a run that fails. The test keeps its flaky entry until then.
Reproduced on current master C rollback under ASAN/UBSAN, slow allocation unwinder, four CPUs with three competing CPU processes, cold Mesa shaders. The unchanged first case reports 192512 samples, 111319 loud samples, two tone breaks.
Temporary tracing identifies the placement discontinuity: at 7.472 s the displayed video timestamp is 4.100 s and timing_adjust jumps forward 300 ms. At 7.487 s the next audio packet is placed rather than appended, inserting the corresponding silence. At 9.793 s the video adjustment drops 133 ms and audio repositions again. The initial idle run passes all six assertions with no such shifts.
Investigating the Video Delay filter queue: after initial buffering it pops exactly one old frame per graphics-selected incoming frame. A graphics stall changes that cadence, so it can later return frames too old or too new for the configured delay. I am testing a timestamp-based selection (newest eligible frame, hold when none is old enough) with a deterministic synthetic timestamp sequence before changing audio timing thresholds.
Update: #3515 contains a scoped partial fix, not a resolution of this audio failure. Two deterministic cases expose independent Video Delay queue errors after skipped input ticks and historical timestamp gaps; the new timestamp-based selector fixes both (plus zero-delay and timestamp-reset guards pass under ASAN/UBSAN with leak detection).
Crucially, the same four-CPU/three-load/cold-shader/slow-unwinder audio reproduction still fails with the corrected filter (191488 samples, 109680 loud, two breaks). Another traced run passes. The exemption therefore stays, and the PR uses Refs, not Fixes. The video reanchor discontinuity is established, but attributing the remaining dropout entirely to the filter queue would be wrong; the upstream async frame pacing/graphics timing still needs investigation.
Additional trace for the remaining investigation: the first delayed frame (timestamp 0) is rendered at roughly 3.08 s; the following graphics pacing call has a 1.1 s system-time gap. The filter receives a selected timestamp near 4.1 s, and its existing is_timestamp_jump rule treats a forward gap over one second as a new timeline, flushing/refilling the delay queue. The next delayed picture does not render until about 7.2 s. This can change the video-derived audio anchor again.
#3515 intentionally preserves that forward-jump/rewind reset behavior and tests it. Relaxing the jump rule merely because a delay is long would need to distinguish graphics-dropped input timestamps from an actual media seek; otherwise it risks replaying pre-seek pictures. That is a focused next investigation, separate from the proven queue-selection cases.
Continuing #3368 from the earlier #3515 investigation. I will reproduce the remaining dropout on current master, trace the video-derived audio anchor across a delayed startup and graphics stall, and add a deterministic RED regression before changing the timing logic. The existing audio test and sanitizer exemption stay unchanged until the real dropout is resolved.
Claiming: continuing my earlier #3368 investigation. Current master reproduces two tone breaks under four-CPU, three-process load with slow ASan unwinding and cold Mesa. The trace identifies a 30-frame queue overflow resetting last_frame_ts to zero during first-texture shader compilation; the next frame seeds a clock 166.7 ms behind. RED commit 4d7a88c exercises the actual libobs overflow and fails (clock becomes zero); the explicit-stop reset guard passes. One draft PR follows now, with the existing test and exemption unchanged until runtime GREEN is established.
Activity
vpacher commentedon Nov 1, 2026
/ready
vpacher commentedon Nov 1, 2026
Claiming: make test_async_delay_audio independent of real time
Plan (one PR, after #3290):
flakyentry from the known list.First PR: after #3290 merges.
vpacher commentedon Nov 1, 2026
Blocked: waiting on #3290
vpacher commentedon Nov 1, 2026
Findings so far: this looks like a real audio dropout in libobs, not a test that runs out of real time.
Reproduced with the asan build through the sanitizer harness (
run_one_test, soASAN_OPTIONS=...:fast_unwind_on_malloc=0), pinned to 4 cores with load: 2 of 8 runs fail, both in the first case,tone_continuous_with_3s_video_delay, as in CI.An instrumented copy of the test (local only) recorded how late
av_threadhands each packet toobs_source_output_audio():So every packet arrives on time and the mix keeps producing samples, but in a failing run about 15000 to 18000 fewer samples are loud: roughly 300 to 370 ms of the tone is missing from the mix. The log shows OBS's INFO lines but no "adding ... audio buffering" and no timestamp message in that case.
That points at the audio timing path that upstream obsproject/obs-studio#13830 is about (placing the source's audio by the delayed video's timing,
timing_adjustagainstMAX_TS_VAR), which a slow run (the harness option makes this build about 4 times slower) seems to reach again, only right after startup with the 3 s delay. Next step is to instrument that path (timing resets,timing_adjust, the audio placement) in a run that fails. The test keeps itsflakyentry until then.5 remaining items
zackees commentedon Nov 2, 2026
Reproduced on current master C rollback under ASAN/UBSAN, slow allocation unwinder, four CPUs with three competing CPU processes, cold Mesa shaders. The unchanged first case reports 192512 samples, 111319 loud samples, two tone breaks.
Temporary tracing identifies the placement discontinuity: at 7.472 s the displayed video timestamp is 4.100 s and timing_adjust jumps forward 300 ms. At 7.487 s the next audio packet is placed rather than appended, inserting the corresponding silence. At 9.793 s the video adjustment drops 133 ms and audio repositions again. The initial idle run passes all six assertions with no such shifts.
Investigating the Video Delay filter queue: after initial buffering it pops exactly one old frame per graphics-selected incoming frame. A graphics stall changes that cadence, so it can later return frames too old or too new for the configured delay. I am testing a timestamp-based selection (newest eligible frame, hold when none is old enough) with a deterministic synthetic timestamp sequence before changing audio timing thresholds.
zackees commentedon Nov 2, 2026
Update: #3515 contains a scoped partial fix, not a resolution of this audio failure. Two deterministic cases expose independent Video Delay queue errors after skipped input ticks and historical timestamp gaps; the new timestamp-based selector fixes both (plus zero-delay and timestamp-reset guards pass under ASAN/UBSAN with leak detection).
Crucially, the same four-CPU/three-load/cold-shader/slow-unwinder audio reproduction still fails with the corrected filter (191488 samples, 109680 loud, two breaks). Another traced run passes. The exemption therefore stays, and the PR uses Refs, not Fixes. The video reanchor discontinuity is established, but attributing the remaining dropout entirely to the filter queue would be wrong; the upstream async frame pacing/graphics timing still needs investigation.
fix(obs-filters): select delayed frames by timestamp (#3368)
zackees commentedon Nov 2, 2026
Additional trace for the remaining investigation: the first delayed frame (timestamp 0) is rendered at roughly 3.08 s; the following graphics pacing call has a 1.1 s system-time gap. The filter receives a selected timestamp near 4.1 s, and its existing is_timestamp_jump rule treats a forward gap over one second as a new timeline, flushing/refilling the delay queue. The next delayed picture does not render until about 7.2 s. This can change the video-derived audio anchor again.
#3515 intentionally preserves that forward-jump/rewind reset behavior and tests it. Relaxing the jump rule merely because a delay is long would need to distinguish graphics-dropped input timestamps from an actual media seek; otherwise it risks replaying pre-seek pictures. That is a focused next investigation, separate from the proven queue-selection cases.
fix(obs-filters): keep async video delay stable across skipped ticks (o…
zackees commentedon Nov 5, 2026
Continuing #3368 from the earlier #3515 investigation. I will reproduce the remaining dropout on current master, trace the video-derived audio anchor across a delayed startup and graphics stall, and add a deterministic RED regression before changing the timing logic. The existing audio test and sanitizer exemption stay unchanged until the real dropout is resolved.
zackees commentedon Nov 5, 2026
Claiming: continuing my earlier #3368 investigation. Current master reproduces two tone breaks under four-CPU, three-process load with slow ASan unwinding and cold Mesa. The trace identifies a 30-frame queue overflow resetting last_frame_ts to zero during first-texture shader compilation; the next frame seeds a clock 166.7 ms behind. RED commit 4d7a88c exercises the actual libobs overflow and fails (clock becomes zero); the explicit-stop reset guard passes. One draft PR follows now, with the existing test and exemption unchanged until runtime GREEN is established.
fix: keep async source timing when the frame queue overflows (#3368)
fix: preserve async audio timing after video queue overflow (obs-rust…