Skip to content

test: Keep the audio thread out of test_audio_clock_drift - #3587

Merged
vpacher merged 1 commit into
masterfrom
fix/3576-drift-audio-thread
Nov 3, 2026
Merged

vpacher merged 1 commit into
masterfrom
fix/3576-drift-audio-thread

Conversation

@vpacher

@vpacher vpacher commented Nov 3, 2026

Copy link
Copy Markdown
Member

What changed

test_audio_clock_drift now parks the audio thread in an OBS_TASK_AUDIO task while it owns the source's buffer, and resumes it before it releases the source. The test leaves the asan known list, and KNOWN_ENTRIES goes from 6 to 5.

Cause

The audio thread's discard_audio() runs on every source on its list, also one that is removed from the mix. The test's first stamp maps to the real clock, and only later packets move ahead of it. A stall in the first packets leaves the buffer behind the real clock, so a tick consumes from it, and the test counts a dropout.

This is a test bug. For a real source, discarding audio that is behind is the expected behavior.

RED and GREEN

I added a stall at packet 3 of slow_device_clock_has_no_dropouts. I did not commit it. These runs use a TSan build with reports off.

Stall Without the fix With the fix
20 ms 0 dropouts
60 ms 1 dropout, 0 clicks
500 ms 1 dropout, 0 clicks 0 dropouts
2000 ms 0 dropouts

The failure on #3563 had the same shape: 1 dropout, 0 clicks. All 6 cases pass with the fix and no stall.

Test cost: no new test. The test adds no running threads: it parks the existing audio thread. Its run time is not measured separately, but the fix adds no wait beyond the task hand-off.

Fixes #3576

🤖 Generated with Claude Code

The audio thread discards from every source on its list, also one that is
removed from the mix. The first stamp maps to the real clock, so a stall in
the first packets left the buffer behind that clock, a tick consumed it and
the test counted a dropout. Park the audio thread in a task while the test
owns the buffer, and drop the test from the asan known list.

Fixes #3576

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=9dfdd2a172a8e8fb50ac65ff9e28d1498d644013 secs=280 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1793734590,"gate":"rust/all/fmt","host":"linux-x86_64","key":"f9e916798e8b96bfce077362596f36b019835341205806f8d490f250d005e8e0","lane":"lint","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":36,"stamp":"5716a781a9f5959239bad2d670681cef","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"f9e916798e8b96bfce077362596f36b019835341205806f8d490f250d005e8e0","lane":"lint","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":36,"stamp":"a90266c5cd1345fdc9a6c713682595ff","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"bf330e0c1be0e1cf5e9fc4a1831d8ebf4053acc6fa9c1761c46046388345ab7a","lane":"rust-test","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":83,"stamp":"5c8778abc2bf1d6c5b1139bd0845a83e","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"e1f3fb2e30da5d060a838f118f48a361ebd31b5f9ceec6666265887cb2130802","lane":"cross","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":40,"stamp":"4b216074bb25af6df4e8e8af88177ed5","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"e1f3fb2e30da5d060a838f118f48a361ebd31b5f9ceec6666265887cb2130802","lane":"cross","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":40,"stamp":"9e7d22a9e13e5b23f406d57e5a18228d","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"e1f3fb2e30da5d060a838f118f48a361ebd31b5f9ceec6666265887cb2130802","lane":"cross","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":40,"stamp":"2f3ad7103f9f4130bd9c3564f4ee1f63","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"e1f3fb2e30da5d060a838f118f48a361ebd31b5f9ceec6666265887cb2130802","lane":"cross","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":40,"stamp":"baefd63288ea205e30b6ec2421e523f0","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
Ci-Attestation: {"at":1793734590,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"a9a90824a988d6db007dd39dbdad8cde456134d00bbc80af33f965cd506a7a92","lane":"tier2-linux","parents":["8c414e5426cd126e07889ad9a3bf3243d9f0d386"],"secs":280,"stamp":"82b6eee424cd6a6581d3453c99ea5a8f","tree":"9dfdd2a172a8e8fb50ac65ff9e28d1498d644013","v":1,"via":"run"}
@vpacher
vpacher requested a review from zackees as a code owner November 3, 2026 19:37
@vpacher
vpacher enabled auto-merge November 3, 2026 19:37
@vpacher
vpacher added this pull request to the merge queue Nov 3, 2026
Merged via the queue into master with commit 54874a8 Nov 3, 2026
37 checks passed
@vpacher
vpacher deleted the fix/3576-drift-audio-thread branch November 3, 2026 19:56
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.

bug: test_audio_clock_drift can report one dropout early in a run

1 participant