From 228f68ab6d33fac45cd5b5e0749ff22b671fa674 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Tue, 2 Jun 2026 22:02:32 +0000 Subject: [PATCH] fix(audio): use_wallclock_as_timestamps on both raw FIFOs to align A/V by arrival time (no deadlock, replaces barrier) --- services/capture/src/capture-manager.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/capture/src/capture-manager.js b/services/capture/src/capture-manager.js index 0dc17cc..9003b3b 100644 --- a/services/capture/src/capture-manager.js +++ b/services/capture/src/capture-manager.js @@ -613,11 +613,22 @@ class CaptureManager { return { inputArgs: [ + // Both raw FIFOs are timestampless. ffmpeg opens input 0 (video) and + // input 1 (audio) at slightly different moments, so PTS-zeroing each + // stream's first byte would bake in a fixed A/V offset. Stamping each + // input by wall-clock ARRIVAL time aligns them by real time regardless + // of FIFO open order — the robust fix for the A/V start offset. + // Large thread_queue_size avoids "thread message queue blocking" on + // the high-bitrate raw video FIFO. + '-use_wallclock_as_timestamps', '1', + '-thread_queue_size', '512', '-f', 'rawvideo', '-pix_fmt', 'uyvy422', '-video_size', dcSize, '-framerate', dcFps, '-i', videoFifo, + '-use_wallclock_as_timestamps', '1', + '-thread_queue_size', '512', '-f', 's16le', '-ar', '48000', '-ac', '2',