From 512ca609b28332f27709b2df46ccfb5678a83495 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 PiperOrigin-RevId: 512580395 (cherry picked from commit d0cbf0fce84aa73be5eb68935d6a4dd2f2e1dc3d) --- RELEASENOTES.md | 17 ++++++++--------- .../exoplayer/mediacodec/MediaCodecInfo.java | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index aaa533e8c48..62210b405db 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -30,7 +30,11 @@ * Video: * Map HEVC HDR10 format to `HEVCProfileMain10HDR10` instead of `HEVCProfileMain10`. -* DASH: +* Add workaround for a device issue on Chromecast with Google TV and + Lenovo M10 FHD Plus that causes 60fps AVC streams to be marked as + unsupported + ([#10898](https://github.com/google/ExoPlayer/issues/10898)). +* DASH: * Add full parsing for image adaptation sets, including tile counts ([#3752](https://github.com/google/ExoPlayer/issues/3752)). * RTSP: @@ -94,15 +98,10 @@ This release corresponds to the parsing trak atoms. * Correctly skip samples when seeking directly to a sync frame in fMP4 ([#10941](https://github.com/google/ExoPlayer/issues/10941)). - * Fix `NullPointerException` when calling `ExoPlayer.isTunnelingEnabled` - ([#10977](https://github.com/google/ExoPlayer/issues/10977)). -* Audio: - * Use the compressed audio format bitrate to calculate the min buffer size +* Audio: + * Use the compressed audio format bitrate to calculate the min buffer size for `AudioTrack` in direct playbacks (passthrough). - * Fix bug where some playbacks fail when tunneling is enabled and - `AudioProcessors` are active, e.g. for gapless trimming - ([#10847](https://github.com/google/ExoPlayer/issues/10847)). -* Text: +* Text: * Fix `TextRenderer` passing an invalid (negative) index to `Subtitle.getEventTime` if a subtitle file contains no cues. * SubRip: Add support for UTF-16 files if they start with a byte order 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 e49a9a5a3cc..d36f9eb07b9 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 @@ -857,7 +857,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; @@ -876,6 +876,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) @@ -900,7 +911,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; }