From 0ed8e86ba4cd2dcf0f27fa0b91979e89360a6e57 Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 5 Jul 2018 05:26:11 -0700 Subject: [PATCH] Allow overriding of setOutputSurface workarounds Since this is an ongoing problem, it's reasonable that we allow developers to toggle these workarounds without too much hassle. Issue: #4468 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=203364488 --- .../video/MediaCodecVideoRenderer.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java index f5e5f7da68..b0234c4f3f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java @@ -1180,23 +1180,35 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { } /** - * Returns whether the device is known to handle {@link DummySurface} incorrectly. + * Returns whether the codec is known to handle {@link DummySurface} incorrectly. * *

If true is returned then use of {@link DummySurface} is disabled. + * + * @param name The name of the codec. + * @return True if the device is known to handle {@link DummySurface} incorrectly. */ - private static boolean codecNeedsDummySurfaceWorkaround(String name) { + protected boolean codecNeedsDummySurfaceWorkaround(String name) { // Work around https://github.com/google/ExoPlayer/issues/4419. return ("Amazon".equals(Util.MANUFACTURER) && "AFTN".equals(Util.MODEL)) // FireTV 4K && "OMX.amlogic.avc.decoder.awesome".equals(name); } /** - * Returns whether the device is known to implement {@link MediaCodec#setOutputSurface(Surface)} + * Returns whether the codec is known to implement {@link MediaCodec#setOutputSurface(Surface)} * incorrectly. - *

- * If true is returned then we fall back to releasing and re-instantiating the codec instead. + * + *

If true is returned then we fall back to releasing and re-instantiating the codec instead. + * + *

Note: This workaround should only be used if {@link MediaCodec#setOutputSurface(Surface)} + * doesn't work when transitioning between two real surfaces. If an issue only occurs when + * transitioning to or from {@link DummySurface}, then {@link + * #codecNeedsDummySurfaceWorkaround(String)} should be used instead. + * + * @param name The name of the codec. + * @return True if the device is known to implement {@link MediaCodec#setOutputSurface(Surface)} + * incorrectly. */ - private static boolean codecNeedsSetOutputSurfaceWorkaround(String name) { + protected boolean codecNeedsSetOutputSurfaceWorkaround(String name) { // Work around https://github.com/google/ExoPlayer/issues/3236, // https://github.com/google/ExoPlayer/issues/3355, // https://github.com/google/ExoPlayer/issues/3439,