From 40604c716c89861294eb0f69c1e4a858d6d1d545 Mon Sep 17 00:00:00 2001 From: Mollusk Date: Sun, 19 Jul 2026 14:49:42 -0400 Subject: [PATCH] debug: add PIXELPASS_TS_DUMP tap for A/V drift analysis When PIXELPASS_TS_DUMP= is set, tee the muxed MPEG-TS to a file in addition to the normal fd=1 serve path, so the host-side stream can be ffprobe'd for capture-side audio/video PTS drift. Each tee branch gets its own queue so the disk sink cannot backpressure the live serve branch. No effect when the variable is unset, mirroring PIXELPASS_GST_DEBUG. Used to establish that the host produces an A/V-clean realtime stream (+/-18 ms over 170 s), ruling out the capture side in the screen-share drift investigation. Co-Authored-By: Claude Opus 4.8 --- src/host/pipeline.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/host/pipeline.rs b/src/host/pipeline.rs index 0ec5638..9f53825 100644 --- a/src/host/pipeline.rs +++ b/src/host/pipeline.rs @@ -189,9 +189,32 @@ fn build_args( "!".into(), "queue".into(), "!".into(), - "fdsink".into(), - "fd=1".into(), ]; + // Debug A/V-drift tap: when PIXELPASS_TS_DUMP= is set, tee the exact + // muxed TS both to fd=1 (normal serve path, unchanged) and to a file, so the + // host-side stream can be ffprobe'd for capture-side audio/video PTS drift. + // Each tee branch has its own queue so the disk sink can't backpressure the + // live serve branch. No effect when unset. (Mirrors PIXELPASS_GST_DEBUG.) + if let Some(dump) = std::env::var_os("PIXELPASS_TS_DUMP") { + let path = dump.to_string_lossy().into_owned(); + args.extend([ + "tee".into(), + "name=dbgtee".into(), + "!".into(), + "queue".into(), + "!".into(), + "fdsink".into(), + "fd=1".into(), + "dbgtee.".into(), + "!".into(), + "queue".into(), + "!".into(), + "filesink".into(), + format!("location={path}"), + ]); + } else { + args.extend(["fdsink".into(), "fd=1".into()]); + } // Downscale step for the quality presets. `None` = encode at native size // (the "Source" preset, or a source already at/below the target height — we