Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Return windows::core::Error and drop unused mut

Richie McIlroy1c7a83ad7db1
diff --git a/crates/recording/src/output_pipeline/win.rs b/crates/recording/src/output_pipeline/win.rs
index 2d3ca30cf..ee2070db6 100644
--- a/crates/recording/src/output_pipeline/win.rs
+++ b/crates/recording/src/output_pipeline/win.rs
@@ -905,7 +905,10 @@ impl Muxer for WindowsCameraMuxer {
Ok(o) => o,
Err(_) => {
tracing::error!("Camera output mutex poisoned during write");
- return Err(anyhow!("Camera output mutex poisoned"));
+ return Err(windows::core::Error::new(
+ windows::core::HRESULT(-1),
+ "Camera output mutex poisoned"
+ ));
}
};
if let Err(e) = muxer.write_sample(&output_sample, &mut output)
@@ -1711,6 +1714,9 @@ pub fn upload_mf_buffer_to_texture(
unsafe {
let mut texture = None;
device.CreateTexture2D(&texture_desc, Some(&subresource_data), Some(&mut texture))?;
- texture.ok_or_else(|| anyhow!("CreateTexture2D succeeded but returned no texture"))
+ texture.ok_or_else(|| windows::core::Error::new(
+ windows::core::HRESULT(-1),
+ "CreateTexture2D succeeded but returned no texture"
+ ))
}
}
diff --git a/crates/recording/src/sources/screen_capture/windows.rs b/crates/recording/src/sources/screen_capture/windows.rs
index 5eba5115c..6b93dfe98 100644
--- a/crates/recording/src/sources/screen_capture/windows.rs
+++ b/crates/recording/src/sources/screen_capture/windows.rs
@@ -551,7 +551,7 @@ impl output_pipeline::VideoSource for VideoSource {
settings,
d3d_device,
}: Self::Config,
- mut video_tx: mpsc::Sender<Self::Frame>,
+ video_tx: mpsc::Sender<Self::Frame>,
ctx: &mut output_pipeline::SetupCtx,
) -> anyhow::Result<Self>
where