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