Repository navigation
Description
What happens
An NDI source in DistroAV 6.2.2 that sends 100 ms audio frames drops out of the main mix for minutes at a time. The source keeps its audio: a source-record filter on the same source records it without gaps. Only the mix loses it.
Setup: Linux, software rendering, upstream OBS frontend and modules, NDI Test Patterns (stereo, 48 kHz, 4800-sample frames) as the only source in the scene, a main recording. The share of 5 s blocks of the main recording that have the pattern's audio:
| libobs | Present |
|---|---|
| Upstream 33.0.1 (10 min) | 120 of 120 |
33.0.0-beta6, our base |
49 of 49 |
| Our C libobs at 10-31 | 6 of 49 |
| Our production build at 11-04 (10 min) | 20 of 120 |
The audio comes and goes in blocks of about 30 s. Each switch is at a time when libobs logs Audio timestamp for '<source>' exceeded TS_SMOOTHING_THRESHOLD, a jump of about 100 ms. These jumps are single frames that the receiver misses: the NDI SDK receives the sender's frames with 100 ms timecode steps. Upstream sees the same jumps (46 in 10 min) and keeps the audio.
Bisect
Upstream 33.0.1's frontend and modules, our C libobs (OBS_LIBOBS_BACKEND=C) at each step, a 4-minute run, limited to commits that change libobs/. Before the first bad commit every step had 100 %, from it on 24 % to 53 %.
First bad commit: 7d47490 (#522, which fixes #521).
#522 adds && !continuous to the reset in source_output_audio_data(): a packet that was smoothed onto the previous one is placed by the moved timing when the timing moved more than MAX_TS_VAR (2 s), instead of a reset to the system clock. DistroAV stamps the audio with the sender's timecodes, which are not on the system clock.
Not proven yet: that the placement of these packets moves more than 2 s, and that the audio then stays outside the mix window until a jump that is not smoothed resets the timing. The failing test below is to show it.
Proposed fix and failing test
RED: a cmocka test next to test_async_delay_audio with an async source that stamps 100 ms audio frames off the system clock, has async video, and leaves out one frame every few seconds. It checks that the mixed audio has no gap longer than one frame. GREEN: a reset or follow decision that passes this test and keeps the #521 cases of test_async_delay_audio passing. The fix goes into the C (obs-source-audio-timing.c.h) and its Rust port (obs-source::audio_timing), with the differential test.
Expected effect: NDI sources (and other sources with large audio frames and their own clock) lose their audio in the mix after a missed frame, until a later jump resets the timing. Monitoring and outputs that use the mix are silent for that source in that time.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Nov 6, 2026
Claiming: this issue.
test_async_delay_audio: an async source with async video that stamps 100 ms audio frames off the system clock and leaves out one frame every few seconds. The mixed audio must have no gap longer than one frame.obs-source-audio-timing.c.hand its Rust port, so that this test passes and the bug: libobs: Video Delay (Async) over 2 s breaks up the source's audio (upstream obsproject/obs-studio#13830) #521 cases still pass.One PR. First push tomorrow.
docs: Add the NDI audio clock fix to the features ledger
libobs: Follow the video timing only for audio on the video's clock (o…
libobs: Keep a timing of its own for audio on its own clock (obs-rust…
feat(libobs): compensate the clock drift of own-clock audio (obs-rust…
obs-source: port obs_source_output_video_internal to Rust, GREEN (Fixes
obs-source: port obs_source_output_video_internal to Rust, GREEN (Fixes
obs-source: port obs_source_output_video_internal to Rust (Fixes obs-…