From 9acfe8d801c13dd721afb98d88098d70cc10d54f Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat, 17 Oct 2026 04:16:04 +0900 Subject: [PATCH] fix(cli): start Instant recordings behind a start gate The CLI built Instant recordings without a start gate, so its audio was anchored at the first sample while the screen started at its first encoded frame: a microphone that became ready late played early by its start-up delay (about 1 s in the suite's late-mic recording, as in 0.6). Like the desktop app, the CLI now passes a RecordingStartGate and arms it once the recording is built. --- apps/cli/src/record.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/cli/src/record.rs b/apps/cli/src/record.rs index 58ff1eba1a3..7ffa7b45966 100644 --- a/apps/cli/src/record.rs +++ b/apps/cli/src/record.rs @@ -868,8 +868,13 @@ async fn start_recording( if let Some(fps) = params.fps { builder = builder.with_max_fps(fps); } + // As in the desktop app: the screen and audio tracks both start at + // the gate's arm time, so a microphone that is ready late does not + // move all audio early. The CLI has no start cue to wait for. + let start_gate = cap_recording::RecordingStartGate::new(); + builder = builder.with_start_gate(start_gate.clone()); - builder + let actor = builder .build( #[cfg(target_os = "macos")] Some( @@ -877,11 +882,12 @@ async fn start_recording( ), ) .await - .map(|actor| ActorHandle::Instant { - actor, - _upload_lock: upload_lock, - }) - .map_err(|e| e.to_string()) + .map_err(|e| e.to_string())?; + start_gate.arm(); + Ok(ActorHandle::Instant { + actor, + _upload_lock: upload_lock, + }) } } }