diff --git a/src-tauri/src/capture.rs b/src-tauri/src/capture.rs index a79f85c..f6b2e8b 100644 --- a/src-tauri/src/capture.rs +++ b/src-tauri/src/capture.rs @@ -1,8 +1,7 @@ use std::io::Write; use std::path::PathBuf; use std::process::{Child, ChildStdin, Command, Stdio}; -use std::sync::Arc; -use std::sync::atomic::{AtomicBool, Ordering}; + use std::time::Instant; use anyhow::{anyhow, bail, Context, Result}; @@ -29,7 +28,6 @@ pub struct CaptureSetup { pub height: u32, pub fps: u32, pub crop: Option, - pub crashed: Arc, } pub struct CaptureHandler { @@ -38,7 +36,6 @@ pub struct CaptureHandler { width: u32, height: u32, scratch: Vec, - crashed: Arc, } impl GraphicsCaptureApiHandler for CaptureHandler { @@ -100,7 +97,6 @@ impl GraphicsCaptureApiHandler for CaptureHandler { width: setup.width, height: setup.height, scratch: Vec::with_capacity(frame_size), - crashed: setup.crashed, }) } @@ -124,8 +120,7 @@ impl GraphicsCaptureApiHandler for CaptureHandler { return Ok(()); } stdin.write_all(&bytes[..expected]).map_err(|e| { - tracing::error!("ffmpeg stdin write failed: {e} - encoder may have crashed"); - self.crashed.store(true, Ordering::Release); + tracing::error!("ffmpeg stdin write failed: {e}"); anyhow!("ffmpeg encoder stopped unexpectedly: {e}") })?; Ok(()) @@ -147,7 +142,6 @@ pub struct CaptureSession { pub width: u32, pub height: u32, pub crop: Option, - pub crashed: Arc, control: CaptureControl, } @@ -210,8 +204,6 @@ pub fn start( let (out_w, out_h) = compute_output_dims(width, height, crop); - let crashed = Arc::new(AtomicBool::new(false)); - let setup = CaptureSetup { output_path: output_path.clone(), ffmpeg_path, @@ -219,7 +211,6 @@ pub fn start( height, fps, crop, - crashed: crashed.clone(), }; let cursor_setting = if capture_cursor { @@ -248,7 +239,6 @@ pub fn start( width: out_w, height: out_h, crop, - crashed, control, }) } @@ -275,10 +265,6 @@ fn compute_output_dims(monitor_w: u32, monitor_h: u32, crop: Option } impl CaptureSession { - pub fn has_crashed(&self) -> bool { - self.crashed.load(Ordering::Acquire) - } - pub fn stop(self) -> Result { self.control .stop() diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 35d001a..ca85a55 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -420,13 +420,6 @@ fn pause_capture(state: State<'_, AppState>) -> Result<(), String> { let session = lock(&state.capture) .take() .ok_or_else(|| "no capture in progress".to_string())?; - if session.has_crashed() { - tracing::warn!("ffmpeg crashed during recording, discarding incomplete capture"); - // Drop the session (cleanup), clear related state - lock(&state.audio).take(); - lock(&state.click_recorder).take(); - return Err("recording failed - ffmpeg encoder crashed".to_string()); - } let elapsed = session.started_at.elapsed().as_secs_f64(); let path = session.stop().map_err(|e| format!("{e:#}"))?; @@ -525,15 +518,10 @@ fn stop_capture(app: AppHandle, state: State<'_, AppState>) -> Result