From 37b9133eb6bafa493d3dfd7e62b218a85223c0db Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 13 Nov 2022 13:27:43 -0600 Subject: [PATCH] Correct media performance class check Media performance class is 12+ even though it has values for 11+ --- .../binding/video/MediaCodecHelper.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 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 2a47dba7..4d14c172 100644 --- a/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java +++ b/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java @@ -3,7 +3,6 @@ package com.limelight.binding.video; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; -import java.lang.reflect.Field; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -715,19 +714,12 @@ public class MediaCodecHelper { // HEVC decoder present is fast and modern enough for streaming. // // [5.3/H-1-1] MUST NOT drop more than 2 frames in 10 seconds (i.e less than 0.333 percent frame drop) for a 1080p 60 fps video session under load. - // - // NB: We use reflection here because this field seems to be absent on Amazon Fire OS devices - try { - Field mediaClassField = Build.VERSION.class.getDeclaredField("MEDIA_PERFORMANCE_CLASS"); - int mediaClass = mediaClassField.getInt(null); - if (mediaClass >= Build.VERSION_CODES.S) { - LimeLog.info("Allowing HEVC based on media performance class: " + mediaClass); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + LimeLog.info("Media performance class: " + Build.VERSION.MEDIA_PERFORMANCE_CLASS); + if (Build.VERSION.MEDIA_PERFORMANCE_CLASS >= Build.VERSION_CODES.S) { + LimeLog.info("Allowing HEVC based on media performance class"); return true; } - } catch (NoSuchFieldException e) { - LimeLog.info("Build.VERSION.MEDIA_PERFORMANCE_CLASS not present"); - } catch (IllegalAccessException e) { - e.printStackTrace(); } // If the decoder supports FEATURE_LowLatency, we will assume it is fast and modern enough