Skip to content

bug: test_audio_clock_drift can report one dropout early in a run #3576

Closed

Description

@vpacher

What happens

The asan job failed on #3563 (run 41670689565, attempt 2):

slow device: -140 ppm, 7200 s simulated (720000 packets): 1 dropouts (first at 0.1 s), 0 clicks (max d2 0.00942), 0 altered samples
slow device: audio from a -140 ppm device dropped out
[  FAILED  ] slow_device_clock_has_no_dropouts

The same test passed in attempt 1 and attempt 5 on the same commit. I saw it once, in 13 asan jobs.

Why this is not only a slow runner

The test uses a virtual clock, and its comment says the audio thread never consumes or resets the buffer. So a slow runner should not change the result. One packet at 0.1 s simulated time did not continue the buffer, which means something changed the buffer or the placement.

Two causes to check. I confirmed neither:

  1. source_output_audio_data() still reads the real clock (os_time). A long stall can change the result of a timing step.
  2. The audio thread walks first_audio_source (libobs/obs-audio.c.h). The test removes its source from the mix, but the source stays on that list.

What to do

  1. Run the test in a loop under CPU load, with and without ASan, to get a failure rate.
  2. Log which placement path the failing packet took (source_output_audio_place() against source_output_audio_push_back()).
  3. Fix the test if the cause is test-only. If the audio path can really lose a packet, this is a bug in libobs, and the fix goes there.

Activity

  1. added
    bug
    on Nov 3, 2026
  2. added
    ready
    on Nov 3, 2026
  3. vpacher commented on Nov 3, 2026

    @vpacher
    MemberAuthor

    Claiming: #3576

    The cause is in the test, not in libobs. The first stamp maps to the real clock, so a stall of 60 ms or more in the first packets leaves the buffer behind that clock, and the audio thread's discard_audio() consumes from it. I was wrong in this issue to say that a slow runner should not change the result.

    1. PR: park the audio thread in a task while the test owns the buffer, and drop the known-list entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions