Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
refactor(rendering): remove redundant continue channel from video decoders
Richie McIlroya0a68308f3ee
diff --git a/crates/rendering/src/decoder/ffmpeg.rs b/crates/rendering/src/decoder/ffmpeg.rsindex a988cd802..932afcdc1 100644--- a/crates/rendering/src/decoder/ffmpeg.rs+++ b/crates/rendering/src/decoder/ffmpeg.rs@@ -202,8 +202,6 @@ impl FfmpegDecoder {ready_tx: oneshot::Sender<Result<DecoderInitResult, String>>,use_hw_acceleration: bool,) -> Result<(), String> {- let (continue_tx, continue_rx) = mpsc::channel::<Result<(u32, u32, bool), String>>();-std::thread::spawn(move || {let hw_device_type = if use_hw_acceleration {#[cfg(target_os = "windows")]@@ -224,7 +222,7 @@ impl FfmpegDecoder {let mut this = match cap_video_decode::FFmpegDecoder::new(path.clone(), hw_device_type){Err(e) => {- let _ = continue_tx.send(Err(e));+ let _ = ready_tx.send(Err(e));return;}Ok(v) => {@@ -235,7 +233,6 @@ impl FfmpegDecoder {"FFmpeg decoder created for '{}': {}x{}, hw_accel={}",name, width, height, is_hw);- let _ = continue_tx.send(Ok((width, height, is_hw)));v}};@@ -260,7 +257,7 @@ impl FfmpegDecoder {if first_frame_result.is_none() && is_hw {let mut sw_this = match cap_video_decode::FFmpegDecoder::new(path.clone(), None) {Err(e) => {- let _ = continue_tx.send(Err(format!("Software fallback failed: {e}")));+ let _ = ready_tx.send(Err(format!("Software fallback failed: {e}")));return;}Ok(v) => v,@@ -908,7 +905,7 @@ impl FfmpegDecoder {}});- continue_rx.recv().map_err(|e| e.to_string())?.map(|_| ())+ Ok(())}}diff --git a/crates/rendering/src/decoder/media_foundation.rs b/crates/rendering/src/decoder/media_foundation.rsindex feb6dc19d..3a013fc02 100644--- a/crates/rendering/src/decoder/media_foundation.rs+++ b/crates/rendering/src/decoder/media_foundation.rs@@ -176,12 +176,10 @@ impl MFDecoder {rx: mpsc::Receiver<VideoDecoderMessage>,ready_tx: oneshot::Sender<Result<DecoderInitResult, String>>,) -> Result<(), String> {- let (continue_tx, continue_rx) = mpsc::channel();-std::thread::spawn(move || {let mut decoder = match cap_video_decode::MediaFoundationDecoder::new(&path) {Err(e) => {- let _ = continue_tx.send(Err(e));+ let _ = ready_tx.send(Err(e));return;}Ok(v) => {@@ -196,7 +194,7 @@ impl MFDecoder {"Video '{}' dimensions {}x{} exceed hardware decoder limits ({}x{})",name, width, height, caps.max_width, caps.max_height);- let _ = continue_tx.send(Err(format!(+ let _ = ready_tx.send(Err(format!("Video dimensions {}x{} exceed hardware decoder limits {}x{}",width, height, caps.max_width, caps.max_height)));@@ -212,7 +210,6 @@ impl MFDecoder {caps.max_width,caps.max_height);- let _ = continue_tx.send(Ok((width, height)));v}};@@ -504,7 +501,7 @@ impl MFDecoder {}});- continue_rx.recv().map_err(|e| e.to_string())?.map(|_| ())+ Ok(())}}