From 04f0cc949f0d524d5a8ab367a15716175bacf18f Mon Sep 17 00:00:00 2001 From: tonihei Date: Mon, 27 Feb 2023 11:25:10 +0000 Subject: [PATCH] Add workaround for wrong PerformancePoints on some devices. Some devices were reported to have wrong PerformancePoint sets that cause 60 fps to be marked as unsupported even though they are supported. Issue: google/ExoPlayer#10898 #minor-release PiperOrigin-RevId: 512580395 --- .../exoplayer2/mediacodec/MediaCodecInfo.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java index d60fde32fcd..b6303ef8653 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java @@ -855,7 +855,7 @@ private static boolean needsAdaptationFlushWorkaround(String mimeType) { * @param name The name of the codec. * @return Whether to enable the workaround. */ - private static final boolean needsRotatedVerticalResolutionWorkaround(String name) { + private static boolean needsRotatedVerticalResolutionWorkaround(String name) { if ("OMX.MTK.VIDEO.DECODER.HEVC".equals(name) && "mcv5a".equals(Util.DEVICE)) { // See https://github.com/google/ExoPlayer/issues/6612. return false; @@ -874,6 +874,17 @@ private static boolean needsProfileExcludedWorkaround(String mimeType, int profi && ("sailfish".equals(Util.DEVICE) || "marlin".equals(Util.DEVICE)); } + /** Whether the device is known to have wrong {@link PerformancePoint} declarations. */ + private static boolean needsIgnorePerformancePointsWorkaround() { + // See https://github.com/google/ExoPlayer/issues/10898 and [internal ref: b/267324685]. + return /* Chromecast with Google TV */ Util.DEVICE.equals("sabrina") + || Util.DEVICE.equals("boreal") + /* Lenovo Tablet M10 FHD Plus */ + || Util.MODEL.startsWith("Lenovo TB-X605") + || Util.MODEL.startsWith("Lenovo TB-X606") + || Util.MODEL.startsWith("Lenovo TB-X616"); + } + /** Possible outcomes of evaluating PerformancePoint coverage */ @Documented @Retention(RetentionPolicy.SOURCE) @@ -898,7 +909,9 @@ private static final class Api29 { VideoCapabilities videoCapabilities, int width, int height, double frameRate) { List performancePointList = videoCapabilities.getSupportedPerformancePoints(); - if (performancePointList == null || performancePointList.isEmpty()) { + if (performancePointList == null + || performancePointList.isEmpty() + || needsIgnorePerformancePointsWorkaround()) { return COVERAGE_RESULT_NO_EMPTY_LIST; }