From c40b8156e9946fe95f321a33859f4932292f501f Mon Sep 17 00:00:00 2001 From: Alex Telitsine Date: Mon, 27 Mar 2017 03:58:04 -0700 Subject: [PATCH 1/5] Disables codecIsAdaptive for Odroid-XU4 --- .../mediacodec/MediaCodecRenderer.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index 3fbbfac652..e456d5fd15 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -337,7 +337,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer { } String codecName = decoderInfo.name; - codecIsAdaptive = decoderInfo.adaptive; + codecIsAdaptive = decoderInfo.adaptive && codecSupportsAdaptive(codecName, format); codecNeedsDiscardToSpsWorkaround = codecNeedsDiscardToSpsWorkaround(codecName, format); codecNeedsFlushWorkaround = codecNeedsFlushWorkaround(codecName); codecNeedsAdaptationWorkaround = codecNeedsAdaptationWorkaround(codecName); @@ -1170,5 +1170,19 @@ public abstract class MediaCodecRenderer extends BaseRenderer { return Util.SDK_INT <= 18 && format.channelCount == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(name); } - + /** + * Returns whether the decoder is known to be non adaptive. + *

+ * If false is returned then we explicitly override codecIsAdaptive, + * setting it to false. + * + * @param name The decoder name. + * @param format The input format. + * @return True if the device is known to be non adaptiv . + */ + private static boolean codecSupportsAdaptive(String name, Format format) { + return !( + (Util.SDK_INT == 19 && Util.MODEL.equals("ODROID-XU3") + && ("OMX.Exynos.AVC.Decoder".equals(name) || "OMX.Exynos.AVC.Decoder.secure".equals(name)))); + } } From 9aee406c8ef2755f23b7dc9aa12ad21f6c22ae70 Mon Sep 17 00:00:00 2001 From: Alex Telitsine Date: Mon, 27 Mar 2017 04:10:53 -0700 Subject: [PATCH 2/5] Disables codecIsAdaptive for Odroid-XU4, comment updated --- .../android/exoplayer2/mediacodec/MediaCodecRenderer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index e456d5fd15..2bc3ff285f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -1171,14 +1171,14 @@ public abstract class MediaCodecRenderer extends BaseRenderer { && "OMX.MTK.AUDIO.DECODER.MP3".equals(name); } /** - * Returns whether the decoder is known to be non adaptive. + * Returns whether the decoder is known to be non Adaptive. *

* If false is returned then we explicitly override codecIsAdaptive, * setting it to false. * * @param name The decoder name. * @param format The input format. - * @return True if the device is known to be non adaptiv . + * @return False if the device is known to be non adaptive . */ private static boolean codecSupportsAdaptive(String name, Format format) { return !( From 42f3dcf0da5ad2b3e352346647d630ac4f8684c6 Mon Sep 17 00:00:00 2001 From: Alex Telitsine Date: Thu, 30 Mar 2017 19:50:09 -0700 Subject: [PATCH 3/5] Disables Adaptive workaround for Odroid-XU4 up to SDK 19 in Samsung's Exynos AVC and AVC secure decoders --- .../exoplayer2/mediacodec/MediaCodecRenderer.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index 2bc3ff285f..529704c62e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -337,7 +337,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer { } String codecName = decoderInfo.name; - codecIsAdaptive = decoderInfo.adaptive && codecSupportsAdaptive(codecName, format); + codecIsAdaptive = decoderInfo.adaptive && (codecNeedsDisableAdaptationWorkaround(codecName)==false); codecNeedsDiscardToSpsWorkaround = codecNeedsDiscardToSpsWorkaround(codecName, format); codecNeedsFlushWorkaround = codecNeedsFlushWorkaround(codecName); codecNeedsAdaptationWorkaround = codecNeedsAdaptationWorkaround(codecName); @@ -1171,18 +1171,16 @@ public abstract class MediaCodecRenderer extends BaseRenderer { && "OMX.MTK.AUDIO.DECODER.MP3".equals(name); } /** - * Returns whether the decoder is known to be non Adaptive. + * Returns whether the decoder is needs Apaptive workaround disabled *

* If false is returned then we explicitly override codecIsAdaptive, * setting it to false. * - * @param name The decoder name. - * @param format The input format. - * @return False if the device is known to be non adaptive . + * @return TRUE if the device needs Adaptive workaround disabled */ - private static boolean codecSupportsAdaptive(String name, Format format) { - return !( - (Util.SDK_INT == 19 && Util.MODEL.equals("ODROID-XU3") + private static boolean codecNeedsDisableAdaptationWorkaround(String name) { + return ( + (Util.SDK_INT <= 19 && Util.MODEL.equals("ODROID-XU3") && ("OMX.Exynos.AVC.Decoder".equals(name) || "OMX.Exynos.AVC.Decoder.secure".equals(name)))); } } From 96f56716ce11115fd01fce14512ec4e67cdf957a Mon Sep 17 00:00:00 2001 From: Alex Telitsine Date: Thu, 30 Mar 2017 19:52:15 -0700 Subject: [PATCH 4/5] Disables Adaptive workaround for Odroid-XU4 up to SDK 19 in Samsung's Exynos AVC and AVC secure decoders --- .../android/exoplayer2/mediacodec/MediaCodecRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index 529704c62e..6caf2237a3 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -1175,7 +1175,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer { *

* If false is returned then we explicitly override codecIsAdaptive, * setting it to false. - * + * @param name The decoder name. * @return TRUE if the device needs Adaptive workaround disabled */ private static boolean codecNeedsDisableAdaptationWorkaround(String name) { From d84733c9cf73b9a2ab39cbef660fe6801c973045 Mon Sep 17 00:00:00 2001 From: Alex Telitsine Date: Thu, 30 Mar 2017 19:53:19 -0700 Subject: [PATCH 5/5] Disables Adaptive workaround for Odroid-XU4 up to SDK 19 in Samsung's Exynos AVC and AVC secure decoders --- .../android/exoplayer2/mediacodec/MediaCodecRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index 6caf2237a3..c797920f32 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -1173,7 +1173,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer { /** * Returns whether the decoder is needs Apaptive workaround disabled *

- * If false is returned then we explicitly override codecIsAdaptive, + * If TRUE is returned then we explicitly override codecIsAdaptive, * setting it to false. * @param name The decoder name. * @return TRUE if the device needs Adaptive workaround disabled