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
bug: libobs: audio capture drops out every few minutes from device clock drift (upstream #4600) #270
libobs/obs-source.c:1636: source_output_audio_data() places each async audio packet by counting samples from the previous one, as long as the packet's timestamp stays within TS_SMOOTHING_THRESHOLD (70 ms, :1489) of the count. Beyond that it resyncs to the timestamp (handle_ts_jump(), :1509).
Class
Audio dropout: 70 ms of audio lost or 70 ms of silence inserted, periodically, in recordings and streams.
How it is reached
Any capture device runs on its own clock, slightly off its nominal rate (Basvg measured one at +140 ppm in the upstream thread). The capture plugins stamp packets with the system clock, so the stamps drift away from the sample count by that much every second. After 70 ms / 140 ppm = 500 s libobs gives up counting and jumps to the stamp: a fast device loses 70 ms of audio, a slow one gets 70 ms of silence, and the cycle repeats every ~8 minutes. Users report it from Windows, macOS and Linux (PulseAudio/PipeWire, ALSA, JACK).
Reproduced with the real libobs input path on a virtual clock: a +140 ppm device fed for 2 simulated hours gives 14 dropouts, the first at exactly 500 s.
Proposed fix and failing test
Fix: port norihiro's asynchronous sample rate conversion (upstream PR obsproject/obs-studio#6351, open since 2022): each source measures how far its sample count runs ahead of its timestamps and feeds that to its resampler, where a loop filter sets a small swresample compensation so the audio keeps pace with the device clock. Enabled for linux-jack, linux-pulseaudio and linux-alsa; a device on the system clock passes through bit for bit.
RED test (cmocka, test_audio_clock_drift): drifting devices at ±140, ±300 and ±800 ppm, with and without jitter, plus guards for an exact-rate device and for sources that do not opt in. 4 of 6 fail today.
Related: #190 fixed a different cause of stutter in the same upstream thread (packets arriving in bursts); this one is the slow drift of the device clock.
RED: test_audio_clock_drift (4 of 6 failing): drifting devices on a virtual clock through the real libobs input path; +140 ppm gives a dropout every 500 s.
Cause, as Basvg's and norihiro's measurements in that thread showed: a capture device runs on its own clock, slightly off its nominal rate, while libobs counts its samples against system-clock timestamps. Once the two drift 70 ms apart (500 s at the +140 ppm Basvg measured), libobs jumps to the timestamp and 70 ms of audio are lost or silence is inserted. Now each source measures that drift and its resampler compensates for it slightly, so the audio keeps pace with the device clock. This is a port of norihiro's upstream PR obsproject/obs-studio#6351, credited as co-author. The test simulates hours of a drifting device through the real libobs input path: at ±140 ppm it went from 14 dropouts in 2 hours to none, and a device that is exactly on rate passes through unchanged.
Scope: it is on for the Linux capture plugins (JACK, PulseAudio/PipeWire, ALSA). Windows and macOS capture sources are unchanged in this fork. It was tested with a simulated device, so results on real hardware over a long session would be very useful.
obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.
If you try it, a short reply here on whether the dropouts are gone would really help.
Activity
rdoupe commentedon Oct 11, 2026
Claiming: this issue.
test_audio_clock_drift(4 of 6 failing): drifting devices on a virtual clock through the real libobs input path; +140 ppm gives a dropout every 500 s.PR today.
libobs: Add failing test for audio device clock drift dropouts
libobs: Compensate for the clock drift of audio devices
rdoupe commentedon Oct 11, 2026
@floele you reported this in obsproject/obs-studio#4600, so a heads-up: it's fixed here in obs-rust by #271, merged today with a regression test.
Cause, as Basvg's and norihiro's measurements in that thread showed: a capture device runs on its own clock, slightly off its nominal rate, while libobs counts its samples against system-clock timestamps. Once the two drift 70 ms apart (500 s at the +140 ppm Basvg measured), libobs jumps to the timestamp and 70 ms of audio are lost or silence is inserted. Now each source measures that drift and its resampler compensates for it slightly, so the audio keeps pace with the device clock. This is a port of norihiro's upstream PR obsproject/obs-studio#6351, credited as co-author. The test simulates hours of a drifting device through the real libobs input path: at ±140 ppm it went from 14 dropouts in 2 hours to none, and a device that is exactly on rate passes through unchanged.
Scope: it is on for the Linux capture plugins (JACK, PulseAudio/PipeWire, ALSA). Windows and macOS capture sources are unchanged in this fork. It was tested with a simulated device, so results on real hardware over a long session would be very useful.
obs-rust is an AI-assisted fork of OBS; on Arch it's
obs-studio-rust-gitin the AUR.If you try it, a short reply here on whether the dropouts are gone would really help.
test: Skip my new core tests when libobs cannot start
test: Skip my new core tests when libobs cannot start