Skip to content

Commit

Permalink
guard VTIsHardwareDecodeSupported()
Browse files Browse the repository at this point in the history
  • Loading branch information
blueboxd committed May 15, 2024
1 parent 922faf5 commit 647f7a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 10 additions & 3 deletions media/gpu/mac/video_toolbox_video_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ namespace media {
namespace {

bool SupportsH264() {
return VTIsHardwareDecodeSupported(kCMVideoCodecType_H264);
if (__builtin_available(macOS 10.13, *)) {
return VTIsHardwareDecodeSupported(kCMVideoCodecType_H264);
} else {
return false;
}
}

bool InitializeVP9() {
#if BUILDFLAG(IS_MAC)
// TODO(crbug.com/1449877): Enable VP9 on iOS.
Expand All @@ -62,7 +65,11 @@ bool SupportsVP9() {
}

bool SupportsAV1() {
return VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1);
if (__builtin_available(macOS 10.13, *)) {
return VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1);
} else {
return false;
}
}

#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
Expand Down
6 changes: 4 additions & 2 deletions media/gpu/mac/vt_video_decode_accelerator_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2513,8 +2513,10 @@ Picture picture(picture_id, frame.bitstream_id, gfx::Rect(frame.image_size),
if (!base::FeatureList::IsEnabled(kVideoToolboxAv1Decoding)) {
continue;
}
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) {
continue;
if (__builtin_available(macOS 10.13, *)) {
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) {
continue;
}
}

// Success! We have AV1 hardware decoding support.
Expand Down

0 comments on commit 647f7a9

Please sign in to comment.