remove crash detection - was false-positive crashing every recording

This commit is contained in:
2026-05-28 01:08:46 +03:00
parent 4b6ca60b2e
commit 1a89a31ff5
2 changed files with 6 additions and 32 deletions
+2 -16
View File
@@ -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<CaptureRect>,
pub crashed: Arc<AtomicBool>,
}
pub struct CaptureHandler {
@@ -38,7 +36,6 @@ pub struct CaptureHandler {
width: u32,
height: u32,
scratch: Vec<u8>,
crashed: Arc<AtomicBool>,
}
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<CaptureRect>,
pub crashed: Arc<AtomicBool>,
control: CaptureControl<CaptureHandler, anyhow::Error>,
}
@@ -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<CaptureRect>
}
impl CaptureSession {
pub fn has_crashed(&self) -> bool {
self.crashed.load(Ordering::Acquire)
}
pub fn stop(self) -> Result<PathBuf> {
self.control
.stop()