commit 7a48aeca1ed554ed7a1383352ab3f4151e5994a9
parent b8c50e3ec1e33e9ee5729305601437a89fa9fd11
Author: Andrew Osmond <aosmond@gmail.com>
Date: Tue, 23 Dec 2025 23:03:03 +0000
Bug 2005011 - Part 1. Expose AV1 and HEVC hardware codec support on Android. r=geckoview-reviewers,media-playback-reviewers,tcampbell,padenot
This will allow our reporting to be accurate about what the platform
actually supports in hardware.
Differential Revision: https://phabricator.services.mozilla.com/D275719
Diffstat:
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
@@ -41,8 +41,8 @@ public final class HardwareCodecCapabilityUtils {
"OMX.rk."
};
private static final String VP9_MIME_TYPE = "video/x-vnd.on2.vp9";
- // List of supported HW H.264 codecs.
- private static final String[] supportedH264HwCodecPrefixes = {
+ // List of supported HW AV1/HEVC/H.264 codecs.
+ private static final String[] supportedGenericHwCodecPrefixes = {
"OMX.qcom.",
"OMX.Intel.",
"OMX.Exynos.",
@@ -303,8 +303,10 @@ public final class HardwareCodecCapabilityUtils {
// Check if MIME type string has HW prefix (encode or decode, VP8, VP9, and H264)
private static String[] getSupportedHWCodecPrefixes(
final String aMimeType, final boolean aIsEncoder) {
- if (aMimeType.equals(H264_MIME_TYPE)) {
- return supportedH264HwCodecPrefixes;
+ if (aMimeType.equals(H264_MIME_TYPE)
+ || aMimeType.equals(HEVC_MIME_TYPE)
+ || aMimeType.equals(AV1_MIME_TYPE)) {
+ return supportedGenericHwCodecPrefixes;
}
if (aMimeType.equals(VP9_MIME_TYPE)) {
return supportedVp9HwCodecPrefixes;
@@ -318,7 +320,9 @@ public final class HardwareCodecCapabilityUtils {
// Return list of HW codec prefixes (encode or decode, VP8, VP9, and H264)
private static String[] getAllSupportedHWCodecPrefixes(final boolean aIsEncoder) {
final Set<String> prefixes = new HashSet<>();
- final String[] mimeTypes = {H264_MIME_TYPE, VP8_MIME_TYPE, VP9_MIME_TYPE};
+ final String[] mimeTypes = {
+ H264_MIME_TYPE, HEVC_MIME_TYPE, AV1_MIME_TYPE, VP8_MIME_TYPE, VP9_MIME_TYPE
+ };
for (final String mt : mimeTypes) {
prefixes.addAll(Arrays.asList(getSupportedHWCodecPrefixes(mt, aIsEncoder)));
}
@@ -336,6 +340,16 @@ public final class HardwareCodecCapabilityUtils {
}
@WrapForJNI
+ public static boolean hasHWAV1(final boolean aIsEncoder) {
+ return getHWCodecCapability(AV1_MIME_TYPE, aIsEncoder);
+ }
+
+ @WrapForJNI
+ public static boolean hasHWHEVC(final boolean aIsEncoder) {
+ return getHWCodecCapability(HEVC_MIME_TYPE, aIsEncoder);
+ }
+
+ @WrapForJNI
public static boolean hasHWH264(final boolean aIsEncoder) {
return getHWCodecCapability(H264_MIME_TYPE, aIsEncoder);
}