Skip to content

bug: libobs: NDI audio with 100 ms frames drops out of the mix for minutes since #522 #3747

Closed

Description

@vpacher

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.

Activity

  1. vpacher commented on Nov 6, 2026

    @vpacher
    MemberAuthor

    Claiming: this issue.

    1. RED: a cmocka test next to 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.
    2. GREEN: change the reset or follow decision in obs-source-audio-timing.c.h and 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.

  2. added
    ready
    on Nov 6, 2026
  3. moved this from In progress to Done in obs-rust Multiviewon Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions