diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 7169a9a0eb..f40ab4c7de 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -18,6 +18,9 @@ This release includes the following changes since * Fix issue where a player without a surface was ready immediately and very slow decoding any pending frames ([#1973](https://github.com/androidx/media/issues/1973)). + * Exclude Xiaomi and OPPO devices from detached surface mode to avoid + screen flickering + ([#2059](https://github.com/androidx/media/issues/2059)). * Session: * Fix bug where a stale notification stays visible when the playlist is cleared ([#2211](https://github.com/androidx/media/issues/2211)). 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 a3e958c007..e4539f04ff 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 @@ -710,7 +710,8 @@ public final class MediaCodecInfo { private static boolean isDetachedSurfaceSupported(@Nullable CodecCapabilities capabilities) { return Util.SDK_INT >= 35 && capabilities != null - && capabilities.isFeatureSupported(CodecCapabilities.FEATURE_DetachedSurface); + && capabilities.isFeatureSupported(CodecCapabilities.FEATURE_DetachedSurface) + && !needsDetachedSurfaceUnsupportedWorkaround(); } private static boolean areSizeAndRateSupported( @@ -858,8 +859,8 @@ public final class MediaCodecInfo { } /** - * 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. + * Returns 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 @@ -867,4 +868,9 @@ public final class MediaCodecInfo { && CodecProfileLevel.HEVCProfileMain10 == profile && ("sailfish".equals(Build.DEVICE) || "marlin".equals(Build.DEVICE)); } + + /** Returns whether the device is known to have issues with the detached surface mode. */ + private static boolean needsDetachedSurfaceUnsupportedWorkaround() { + return Build.MANUFACTURER.equals("Xiaomi") || Build.MANUFACTURER.equals("OPPO"); + } }