Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy

Richie McIlroyfae0156405c9
diff --git a/crates/rendering/src/yuv_converter.rs b/crates/rendering/src/yuv_converter.rs
index 771b0f6d0..6bc394cdb 100644
--- a/crates/rendering/src/yuv_converter.rs
+++ b/crates/rendering/src/yuv_converter.rs
@@ -619,10 +619,9 @@ impl YuvToRgbaConverter {
queue: &wgpu::Queue,
image_buf: &cv::ImageBuf,
) -> Result<&wgpu::TextureView, YuvConversionError> {
- let cache = self
- .iosurface_cache
- .as_ref()
- .ok_or(IOSurfaceTextureError::NoMetalDevice)?;
+ if self.iosurface_cache.is_none() {
+ return Err(IOSurfaceTextureError::NoMetalDevice.into());
+ }
let io_surface = image_buf
.io_surf()
@@ -636,6 +635,7 @@ impl YuvToRgbaConverter {
self.ensure_texture_size(device, effective_width, effective_height);
self.swap_output_buffer();
+ let cache = self.iosurface_cache.as_ref().unwrap();
let y_metal_texture = cache.create_y_texture(io_surface, width, height)?;
let uv_metal_texture = cache.create_uv_texture(io_surface, width, height)?;
diff --git a/crates/video-decode/src/media_foundation.rs b/crates/video-decode/src/media_foundation.rs
index fc0d57f86..a2aa9e2c3 100644
--- a/crates/video-decode/src/media_foundation.rs
+++ b/crates/video-decode/src/media_foundation.rs
@@ -78,13 +78,12 @@ fn query_mf_decoder_capabilities(device: &ID3D11Device) -> MFDecoderCapabilities
};
if let Ok(config_count) = unsafe { video_device.GetVideoDecoderConfigCount(&h264_desc) }
+ && config_count > 0
{
- if config_count > 0 {
- supports_h264 = true;
- max_width = max_width.max(test_w);
- max_height = max_height.max(test_h);
- break;
- }
+ supports_h264 = true;
+ max_width = max_width.max(test_w);
+ max_height = max_height.max(test_h);
+ break;
}
}
@@ -97,13 +96,12 @@ fn query_mf_decoder_capabilities(device: &ID3D11Device) -> MFDecoderCapabilities
};
if let Ok(config_count) = unsafe { video_device.GetVideoDecoderConfigCount(&hevc_desc) }
+ && config_count > 0
{
- if config_count > 0 {
- supports_hevc = true;
- max_width = max_width.max(test_w);
- max_height = max_height.max(test_h);
- break;
- }
+ supports_hevc = true;
+ max_width = max_width.max(test_w);
+ max_height = max_height.max(test_h);
+ break;
}
}