[Android] LibVLC: Media: don't override options set by the LibVLC user.

Thomas Guillem git at videolan.org
Wed Mar 7 12:17:43 CET 2018


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Mar  7 11:47:26 2018 +0100| [142154e3abbad0d969dd8c5cd24652f275884a40] | committer: Thomas Guillem

LibVLC: Media: don't override options set by the LibVLC user.

> https://code.videolan.org/videolan/vlc-android/commit/142154e3abbad0d969dd8c5cd24652f275884a40
---

 libvlc/src/org/videolan/libvlc/Media.java | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 152a3d81e..f297a3f39 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -417,6 +417,9 @@ public class Media extends VLCObject<Media.Event> {
     private int mState = -1;
     private int mType = -1;
     private boolean mCodecOptionSet = false;
+    private boolean mFileCachingSet = false;
+    private boolean mNetworkCachingSet = false;
+
 
     /**
      * Create a Media from libVLC and a local path starting with '/'.
@@ -757,8 +760,10 @@ public class Media extends VLCObject<Media.Event> {
          * for 320x170 H.264, a few packets less on higher resolutions.
          * On Nexus S, the decoder latency seems to be about 7 packets.
          */
-        addOption(":file-caching=1500");
-        addOption(":network-caching=1500");
+        if (!mFileCachingSet)
+            addOption(":file-caching=1500");
+        if (!mNetworkCachingSet)
+            addOption(":network-caching=1500");
 
         final StringBuilder sb = new StringBuilder(":codec=");
         if (decoder == HWDecoderUtil.Decoder.MEDIACODEC || decoder == HWDecoderUtil.Decoder.ALL)
@@ -797,6 +802,10 @@ public class Media extends VLCObject<Media.Event> {
         synchronized (this) {
             if (!mCodecOptionSet && option.startsWith(":codec="))
                 mCodecOptionSet = true;
+            if (!mNetworkCachingSet && option.startsWith(":network-caching="))
+                mNetworkCachingSet = true;
+            if (!mFileCachingSet && option.startsWith(":file-caching="))
+                mFileCachingSet = true;
         }
         nativeAddOption(option);
     }



More information about the Android mailing list