Skip to content

Add runtime AV1 hardware decode detection#124

Merged
alexeichhorn merged 1 commit intomainfrom
feature/native-av1
Mar 1, 2026
Merged

Add runtime AV1 hardware decode detection#124
alexeichhorn merged 1 commit intomainfrom
feature/native-av1

Conversation

@alexeichhorn
Copy link
Owner

@alexeichhorn alexeichhorn commented Jan 29, 2026

Detect AV1 hardware support at runtime. This means we find more isNativelyPlayable streams on AV1-capable devices.

@alexeichhorn alexeichhorn self-assigned this Jan 29, 2026
@alexeichhorn alexeichhorn marked this pull request as ready for review January 29, 2026 21:24
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

This change introduces AV1 hardware decoding detection to the VideoCodec model by adding a private static property that queries VideoToolbox availability and platform support. The implementation replaces a hardcoded false value with runtime checks for iOS 13.0+, macOS 10.15+, and tvOS 13.0+.

Changes

Cohort / File(s) Summary
AV1 Hardware Decode Support
Sources/YouTubeKit/Models/Codecs.swift
Added private static property isAV1HardwareDecodeSupported with conditional VideoToolbox import and platform-specific runtime availability checks (iOS 13.0+, macOS 10.15+, tvOS 13.0+). Delegated VideoCodec.isNativelyPlayable.av1 to use the new property instead of returning false unconditionally.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately reflects the main change: adding runtime detection for AV1 hardware decode support instead of hard-coding it as unavailable.
Description check ✅ Passed The PR description is directly related to the changeset, explaining the purpose of detecting AV1 hardware support at runtime to identify more playable streams.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@Sources/YouTubeKit/Models/Codecs.swift`:
- Around line 82-89: The availability check for kCMVideoCodecType_AV1 is too
permissive; update the guard in the isAV1HardwareDecodeSupported closure so the
runtime/compile-time availability matches the constant's introduction: keep the
canImport(VideoToolbox) check, and change the `#available` condition around the
VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1) call to iOS 17.0, macOS 14.0,
and tvOS 17.0 to ensure kCMVideoCodecType_AV1 is present when referenced; leave
the fallback return false in place if the platform/SDK isn't available.

@alexeichhorn alexeichhorn merged commit 03b71a4 into main Mar 1, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant