[Android] LibVLC: allow to force hw accel on unknow devices

Thomas Guillem git at videolan.org
Wed Mar 22 17:38:27 CET 2017


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Mar 22 17:36:38 2017 +0100| [8082f750420a6ea735f9e9c325c9ba0dfd54c541] | committer: Thomas Guillem

LibVLC: allow to force hw accel on unknow devices

Mainly for 4.2.x devices when the user asked for it.

> https://code.videolan.org/videolan/vlc-android/commit/8082f750420a6ea735f9e9c325c9ba0dfd54c541
---

 libvlc/src/org/videolan/libvlc/Media.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 5a48be5..358a8f4 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -735,12 +735,15 @@ public class Media extends VLCObject<Media.Event> {
      * @param force force hw acceleration even for unknown devices
      */
     public void setHWDecoderEnabled(boolean enabled, boolean force) {
-        final HWDecoderUtil.Decoder decoder = enabled ?
+        HWDecoderUtil.Decoder decoder = enabled ?
                 HWDecoderUtil.getDecoderFromDevice() :
                 HWDecoderUtil.Decoder.NONE;
 
-        if (decoder == HWDecoderUtil.Decoder.NONE ||
-                (decoder == HWDecoderUtil.Decoder.UNKNOWN && !force)) {
+        /* Unknown device but the user asked for hardware acceleration */
+        if (decoder == HWDecoderUtil.Decoder.UNKNOWN && force)
+            decoder = HWDecoderUtil.Decoder.ALL;
+
+        if (decoder == HWDecoderUtil.Decoder.NONE || decoder == HWDecoderUtil.Decoder.UNKNOWN) {
             addOption(":codec=all");
             return;
         }



More information about the Android mailing list