[Android] [PATCH] HWDecoderUtil: per default, only try HW decoders after HoneyComb

Thomas Guillem thomas at gllm.fr
Thu Jan 22 11:26:53 CET 2015


---
 libvlc/src/org/videolan/libvlc/HWDecoderUtil.java | 27 ++++++++++++++---------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java b/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java
index 8e0e903..7d48899 100644
--- a/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java
+++ b/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java
@@ -93,18 +93,25 @@ public class HWDecoderUtil {
      * (Always return Dec.ALL after Android 4.3)
      */
     public static Decoder getDecoderFromDevice() {
+        /*
+         * Always try MediaCodec after JellyBean MR2,
+         * Try OMX or MediaCodec after HoneyComb depending on device properties.
+         * Otherwise, use software decoder by default.
+         */
         if (LibVlcUtil.isJellyBeanMR2OrLater())
             return Decoder.ALL;
-        for (DecoderBySOC decBySOC : sDecoderBySOCList) {
-            String prop = sSystemPropertyMap.get(decBySOC.key);
-            if (prop == null) {
-                prop = getSystemProperty(decBySOC.key, "none");
-                sSystemPropertyMap.put(decBySOC.key, prop);
-            }
-            if (prop != null) {
-                for (String decProp: decBySOC.list)
-                    if (prop.contains(decProp))
-                        return decBySOC.dec;
+        else if (LibVlcUtil.isHoneycombOrLater()) {
+            for (DecoderBySOC decBySOC : sDecoderBySOCList) {
+                String prop = sSystemPropertyMap.get(decBySOC.key);
+                if (prop == null) {
+                    prop = getSystemProperty(decBySOC.key, "none");
+                    sSystemPropertyMap.put(decBySOC.key, prop);
+                }
+                if (prop != null) {
+                    for (String decProp: decBySOC.list)
+                        if (prop.contains(decProp))
+                            return decBySOC.dec;
+                }
             }
         }
         return Decoder.UNKNOWN;
-- 
2.1.3



More information about the Android mailing list