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: video stats (fps, frame time, total/lagged frames) raced between graphics and UI threads #175
On x86-64 the aligned loads are effectively atomic, so today the visible effect is at most a stale value. It is still UB, and video_fps (a double) and the 64-bit fields aren't guaranteed tear-free on 32-bit ARM builds.
Fix
Make them volatile-free atomics: os_atomic_* from util/threading.h, or _Atomic/atomic_* for the double via bit-cast. Alternatively, publish a stats snapshot under a small mutex. Keep the getters' ABI unchanged.
Failing test sketch
A Tier 2 cmocka test that starts video with the null graphics module and polls the four getters from a second thread for a few hundred frames. Under TSan it goes RED today.
Add a focused RED test that concurrently publishes and reads the four stats under ThreadSanitizer.
Synchronize the graphics-thread writes and public getter reads without changing the C API or ABI; keep the test deterministic enough for the local gate.
Run lint, unit and sanitizer checks, stamp the local gate, and open one PR against master. First PR expected today.
Fixed by PR #439, merged as 7cf6f39. The four graphics-thread stats and the output start/stop frame-count snapshots now use one private mutex; the public getter signatures and exported symbols are unchanged. A concurrent test reported three races under TSan at the RED commit and none after the fix. The local lint and OFF/ON unit gate passed. No remaining work is known for this race.
Activity
zackees commentedon Oct 13, 2026
Claiming: video-stat publication race.
zackees commentedon Oct 13, 2026
Fixed by PR #439, merged as 7cf6f39. The four graphics-thread stats and the output start/stop frame-count snapshots now use one private mutex; the public getter signatures and exported symbols are unchanged. A concurrent test reported three races under TSan at the RED commit and none after the fix. The local lint and OFF/ON unit gate passed. No remaining work is known for this race.
obs-core: swap audio-info and video-statistics queries to safe Rust (…