From 656eaf74d13d5c35b67ef16b21c6ddbdd1266fc8 Mon Sep 17 00:00:00 2001 From: tonihei Date: Wed, 6 Jul 2022 09:46:27 +0000 Subject: [PATCH] Exclude HEVC 10bit profile on Pixel 1. This profile is declared as supported although it isn't. Issue: google/ExoPlayer#10345 Issue: google/ExoPlayer#3537 #minor-release PiperOrigin-RevId: 459205512 --- .../exoplayer/mediacodec/MediaCodecInfo.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java index a435e6c9ef..745cdc5474 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java @@ -317,7 +317,9 @@ public final class MediaCodecInfo { } for (CodecProfileLevel profileLevel : profileLevels) { - if (profileLevel.profile == profile && profileLevel.level >= level) { + if (profileLevel.profile == profile + && profileLevel.level >= level + && !needsProfileExcludedWorkaround(mimeType, profile)) { return true; } } @@ -831,4 +833,15 @@ public final class MediaCodecInfo { } return true; } + + /** + * Whether a profile is excluded from the list of supported profiles. This may happen when a + * device declares support for a profile it doesn't actually support. + */ + private static boolean needsProfileExcludedWorkaround(String mimeType, int profile) { + // See https://github.com/google/ExoPlayer/issues/3537 + return MimeTypes.VIDEO_H265.equals(mimeType) + && CodecProfileLevel.HEVCProfileMain10 == profile + && ("sailfish".equals(Util.DEVICE) || "marlin".equals(Util.DEVICE)); + } }