From 6aac8e6be6ab78671ca90cd49fefd3943736df36 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 3 Jun 2022 19:03:56 -0500 Subject: [PATCH] Use amazon.hardware.fire_tv feature to detect Fire TV devices --- .../binding/video/MediaCodecHelper.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java b/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java index 93b640b3..8405f7a4 100644 --- a/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java +++ b/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java @@ -145,16 +145,6 @@ public class MediaCodecHelper { // TODO: This needs a similar fixup to the Tegra 3 otherwise it buffers 16 frames } - // Older Sony ATVs (SVP-DTV15) have broken MediaTek codecs (decoder hangs after rendering the first frame). - // I know the Fire TV 2 and 3 works, so I'll whitelist Amazon devices which seem to actually be tested. - if (Build.MANUFACTURER.equalsIgnoreCase("Amazon")) { - whitelistedHevcDecoders.add("omx.mtk"); - - // This requires setting vdec-lowlatency on the Fire TV 3, otherwise the decoder - // never produces any output frames. - whitelistedHevcDecoders.add("omx.amlogic"); - } - // Plot twist: On newer Sony devices (BRAVIA_ATV2, BRAVIA_ATV3_4K, BRAVIA_UR1_4K) the H.264 decoder crashes // on several configurations (> 60 FPS and 1440p) that work with HEVC, so we'll whitelist those devices for HEVC. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Build.DEVICE.startsWith("BRAVIA_")) { @@ -276,6 +266,19 @@ public class MediaCodecHelper { return; } + // Older Sony ATVs (SVP-DTV15) have broken MediaTek codecs (decoder hangs after rendering the first frame). + // I know the Fire TV 2 and 3 works, so I'll whitelist Amazon devices which seem to actually be tested. + // We still have to check Build.MANUFACTURER to catch Amazon Fire tablets. + if (context.getPackageManager().hasSystemFeature("amazon.hardware.fire_tv") || + Build.MANUFACTURER.equalsIgnoreCase("Amazon")) { + whitelistedHevcDecoders.add("omx.mtk"); + + // This requires setting vdec-lowlatency on the Fire TV 3, otherwise the decoder + // never produces any output frames. See comment above for details on why we only + // do this for Fire TV devices. + whitelistedHevcDecoders.add("omx.amlogic"); + } + ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo();