Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
clippy
Richie McIlroy7a66fac0e381
diff --git a/apps/desktop/src-tauri/src/editor_window.rs b/apps/desktop/src-tauri/src/editor_window.rsindex 073b9d026..46a3bbd1c 100644--- a/apps/desktop/src-tauri/src/editor_window.rs+++ b/apps/desktop/src-tauri/src/editor_window.rs@@ -56,16 +56,16 @@ async fn do_prewarm(app: AppHandle, path: PathBuf) -> PendingResult {Box::new(move |frame| {let width = frame.width;let height = frame.height;- if let Ok((data, stride)) = strip_frame_padding(frame) {- if let Err(e) = frame_tx.send(Some(WSFrame {+ if let Ok((data, stride)) = strip_frame_padding(frame)+ && let Err(e) = frame_tx.send(Some(WSFrame {data,width,height,stride,created_at: Instant::now(),- })) {- debug!("Frame receiver dropped during prewarm: {e}");- }+ }))+ {+ debug!("Frame receiver dropped during prewarm: {e}");}}),)@@ -218,16 +218,16 @@ impl EditorInstances {Box::new(move |frame| {let width = frame.width;let height = frame.height;- if let Ok((data, stride)) = strip_frame_padding(frame) {- if let Err(e) = frame_tx.send(Some(WSFrame {+ if let Ok((data, stride)) = strip_frame_padding(frame)+ && let Err(e) = frame_tx.send(Some(WSFrame {data,width,height,stride,created_at: Instant::now(),- })) {- debug!("Frame receiver dropped in get_or_create: {e}");- }+ }))+ {+ debug!("Frame receiver dropped in get_or_create: {e}");}}),)diff --git a/apps/desktop/src/utils/socket.ts b/apps/desktop/src/utils/socket.tsindex e5d2dc83a..b34511f85 100644--- a/apps/desktop/src/utils/socket.ts+++ b/apps/desktop/src/utils/socket.ts@@ -88,12 +88,20 @@ export function createImageDataWS(let producer: Producer | null = null;if (SAB_SUPPORTED) {- const init = createSharedFrameBuffer(FRAME_BUFFER_CONFIG);- producer = createProducer(init);- worker.postMessage({- type: "init-shared-buffer",- buffer: init.buffer,- });+ try {+ const init = createSharedFrameBuffer(FRAME_BUFFER_CONFIG);+ producer = createProducer(init);+ worker.postMessage({+ type: "init-shared-buffer",+ buffer: init.buffer,+ });+ } catch (e) {+ console.error(+ "[socket] SharedArrayBuffer allocation failed, falling back to non-SAB mode:",+ e instanceof Error ? e.message : e,+ );+ producer = null;+ }}const [hasRenderedFrame, setHasRenderedFrame] = createSignal(false);diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 9ad74ec1c..bdabd6466 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -11,6 +11,9 @@ async setMicInput(label: string | null) : Promise<null> {async setCameraInput(id: DeviceOrModelID | null) : Promise<null> {return await TAURI_INVOKE("set_camera_input", { id });},+async setRecordingMode(mode: RecordingMode) : Promise<null> {+ return await TAURI_INVOKE("set_recording_mode", { mode });+},async uploadLogs() : Promise<null> {return await TAURI_INVOKE("upload_logs");},diff --git a/crates/editor/src/editor_instance.rs b/crates/editor/src/editor_instance.rsindex 7ccaae9e0..fd0c33d9e 100644--- a/crates/editor/src/editor_instance.rs+++ b/crates/editor/src/editor_instance.rs@@ -193,7 +193,9 @@ impl EditorInstance {if let Some(task) = state.preview_task.take() {task.abort();- let _ = task.await;+ if let Err(e) = task.await {+ tracing::warn!("preview task abort await failed: {e}");+ }}self.renderer.stop().await;diff --git a/crates/recording/src/feeds/camera.rs b/crates/recording/src/feeds/camera.rsindex b652c09af..73ed99a91 100644--- a/crates/recording/src/feeds/camera.rs+++ b/crates/recording/src/feeds/camera.rs@@ -575,9 +575,11 @@ async fn setup_camera(if buffer_ready {let _ = unsafe { buffer.SetCurrentLength(data_len as u32) };+ #[allow(clippy::arc_with_non_send_sync)]+ let buffer = std::sync::Arc::new(std::sync::Mutex::new(buffer));let _ = native_recipient.tell(NewNativeFrame(NativeCameraFrame {- buffer: std::sync::Arc::new(std::sync::Mutex::new(buffer)),+ buffer,pixel_format: frame.native().pixel_format,width: frame.native().width as u32,height: frame.native().height as u32,diff --git a/crates/recording/src/output_pipeline/mod.rs b/crates/recording/src/output_pipeline/mod.rsindex f141fefe5..458b20d90 100644--- a/crates/recording/src/output_pipeline/mod.rs+++ b/crates/recording/src/output_pipeline/mod.rs@@ -1,11 +1,13 @@mod async_camera;mod core;pub mod ffmpeg;+#[cfg(target_os = "macos")]mod fragmented;pub use async_camera::*;pub use core::*;pub use ffmpeg::*;+#[cfg(target_os = "macos")]pub use fragmented::*;#[cfg(target_os = "macos")]diff --git a/crates/recording/src/output_pipeline/win.rs b/crates/recording/src/output_pipeline/win.rsindex c06076bfe..419cc7159 100644--- a/crates/recording/src/output_pipeline/win.rs+++ b/crates/recording/src/output_pipeline/win.rs@@ -282,7 +282,7 @@ impl Muxer for WindowsMuxer {let mut output = output.lock().unwrap();let _ = muxer- .write_sample(&output_sample, &mut *output)+ .write_sample(&output_sample, &mut output).map_err(|e| format!("WriteSample: {e}"));Ok(())diff --git a/crates/recording/src/screenshot.rs b/crates/recording/src/screenshot.rsindex f711f5eaa..68a11b3bf 100644--- a/crates/recording/src/screenshot.rs+++ b/crates/recording/src/screenshot.rs@@ -350,7 +350,7 @@ fn capture_bitmap_with(return Err(unsupported_error());}- let mut info = BITMAPINFO {+ let info = BITMAPINFO {bmiHeader: BITMAPINFOHEADER {biSize: std::mem::size_of::<BITMAPINFOHEADER>() as u32,biWidth: width,diff --git a/crates/recording/src/sources/screen_capture/mod.rs b/crates/recording/src/sources/screen_capture/mod.rsindex 536507b7e..da0a4b90b 100644--- a/crates/recording/src/sources/screen_capture/mod.rs+++ b/crates/recording/src/sources/screen_capture/mod.rs@@ -305,25 +305,26 @@ impl<TCaptureFormat: ScreenCaptureFormat> ScreenCaptureConfig<TCaptureFormat> {let target_refresh = validated_refresh_rate(display.refresh_rate());let fps = std::cmp::max(1, std::cmp::min(max_fps, target_refresh));- let output_size: PhysicalSize = crop_bounds- .and_then(|b| -> Option<PhysicalSize> {- #[cfg(target_os = "macos")]- {+ let output_size: PhysicalSize = {+ #[cfg(target_os = "macos")]+ {+ crop_bounds.and_then(|b| {let logical_size = b.size();let scale = display.raw_handle().scale()?;Some(PhysicalSize::new(logical_size.width() * scale,logical_size.height() * scale,))- }+ })+ }- #[cfg(target_os = "windows")]- {- Some(b.size().map(|v| (v / 2.0).floor() * 2.0))- }- })- .or_else(|| display.physical_size())- .ok_or(ScreenCaptureInitError::NoBounds)?;+ #[cfg(target_os = "windows")]+ {+ crop_bounds.map(|b| b.size().map(|v| (v / 2.0).floor() * 2.0))+ }+ }+ .or_else(|| display.physical_size())+ .ok_or(ScreenCaptureInitError::NoBounds)?;Ok(Self {config: Config {diff --git a/crates/rendering/src/layers/display.rs b/crates/rendering/src/layers/display.rsindex c2d4743bc..df1a7ba5b 100644--- a/crates/rendering/src/layers/display.rs+++ b/crates/rendering/src/layers/display.rs@@ -95,7 +95,7 @@ impl DisplayLayer {));}- match format {+ let frame_uploaded = match format {PixelFormat::Rgba => {let src_bytes_per_row = frame_size.x * 4;@@ -118,6 +118,7 @@ impl DisplayLayer {depth_or_array_layers: 1,},);+ true}PixelFormat::Nv12 => {let screen_frame = &segment_frames.screen_frame;@@ -143,6 +144,7 @@ impl DisplayLayer {height: frame_size.y,dst_texture_index: next_texture,});+ true} else {tracing::debug!(width = frame_size.x,@@ -150,6 +152,7 @@ impl DisplayLayer {y_stride,"NV12 conversion succeeded but output texture is None, skipping copy");+ false}}Err(e) => {@@ -160,8 +163,11 @@ impl DisplayLayer {y_stride,"NV12 to RGBA conversion failed");+ false}}+ } else {+ false}}PixelFormat::Yuv420p => {@@ -191,12 +197,17 @@ impl DisplayLayer {height: frame_size.y,dst_texture_index: next_texture,});+ true+ } else {+ false}}- }+ };- self.last_recording_time = Some(current_recording_time);- self.current_texture = next_texture;+ if frame_uploaded {+ self.last_recording_time = Some(current_recording_time);+ self.current_texture = next_texture;+ }}uniforms.write_to_buffer(queue, &self.uniforms_buffer);