File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed
Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -619,10 +619,9 @@ impl YuvToRgbaConverter {
619619 queue : & wgpu:: Queue ,
620620 image_buf : & cv:: ImageBuf ,
621621 ) -> Result < & wgpu:: TextureView , YuvConversionError > {
622- let cache = self
623- . iosurface_cache
624- . as_ref ( )
625- . ok_or ( IOSurfaceTextureError :: NoMetalDevice ) ?;
622+ if self . iosurface_cache . is_none ( ) {
623+ return Err ( IOSurfaceTextureError :: NoMetalDevice . into ( ) ) ;
624+ }
626625
627626 let io_surface = image_buf
628627 . io_surf ( )
@@ -636,6 +635,7 @@ impl YuvToRgbaConverter {
636635 self . ensure_texture_size ( device, effective_width, effective_height) ;
637636 self . swap_output_buffer ( ) ;
638637
638+ let cache = self . iosurface_cache . as_ref ( ) . unwrap ( ) ;
639639 let y_metal_texture = cache. create_y_texture ( io_surface, width, height) ?;
640640 let uv_metal_texture = cache. create_uv_texture ( io_surface, width, height) ?;
641641
Original file line number Diff line number Diff line change @@ -78,13 +78,12 @@ fn query_mf_decoder_capabilities(device: &ID3D11Device) -> MFDecoderCapabilities
7878 } ;
7979
8080 if let Ok ( config_count) = unsafe { video_device. GetVideoDecoderConfigCount ( & h264_desc) }
81+ && config_count > 0
8182 {
82- if config_count > 0 {
83- supports_h264 = true ;
84- max_width = max_width. max ( test_w) ;
85- max_height = max_height. max ( test_h) ;
86- break ;
87- }
83+ supports_h264 = true ;
84+ max_width = max_width. max ( test_w) ;
85+ max_height = max_height. max ( test_h) ;
86+ break ;
8887 }
8988 }
9089
@@ -97,13 +96,12 @@ fn query_mf_decoder_capabilities(device: &ID3D11Device) -> MFDecoderCapabilities
9796 } ;
9897
9998 if let Ok ( config_count) = unsafe { video_device. GetVideoDecoderConfigCount ( & hevc_desc) }
99+ && config_count > 0
100100 {
101- if config_count > 0 {
102- supports_hevc = true ;
103- max_width = max_width. max ( test_w) ;
104- max_height = max_height. max ( test_h) ;
105- break ;
106- }
101+ supports_hevc = true ;
102+ max_width = max_width. max ( test_w) ;
103+ max_height = max_height. max ( test_h) ;
104+ break ;
107105 }
108106 }
109107
You can’t perform that action at this time.
0 commit comments