Skip to content

Commit 647f7a9

Browse files
committed
guard VTIsHardwareDecodeSupported()
1 parent 922faf5 commit 647f7a9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

media/gpu/mac/video_toolbox_video_decoder.cc

+10-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ namespace media {
4242
namespace {
4343

4444
bool SupportsH264() {
45-
return VTIsHardwareDecodeSupported(kCMVideoCodecType_H264);
45+
if (__builtin_available(macOS 10.13, *)) {
46+
return VTIsHardwareDecodeSupported(kCMVideoCodecType_H264);
47+
} else {
48+
return false;
49+
}
4650
}
47-
4851
bool InitializeVP9() {
4952
#if BUILDFLAG(IS_MAC)
5053
// TODO(crbug.com/1449877): Enable VP9 on iOS.
@@ -62,7 +65,11 @@ bool SupportsVP9() {
6265
}
6366

6467
bool SupportsAV1() {
65-
return VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1);
68+
if (__builtin_available(macOS 10.13, *)) {
69+
return VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1);
70+
} else {
71+
return false;
72+
}
6673
}
6774

6875
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)

media/gpu/mac/vt_video_decode_accelerator_mac.mm

+4-2
Original file line numberDiff line numberDiff line change
@@ -2513,8 +2513,10 @@ Picture picture(picture_id, frame.bitstream_id, gfx::Rect(frame.image_size),
25132513
if (!base::FeatureList::IsEnabled(kVideoToolboxAv1Decoding)) {
25142514
continue;
25152515
}
2516-
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) {
2517-
continue;
2516+
if (__builtin_available(macOS 10.13, *)) {
2517+
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) {
2518+
continue;
2519+
}
25182520
}
25192521

25202522
// Success! We have AV1 hardware decoding support.

0 commit comments

Comments
 (0)