[Android] LibVLC: Media

Thomas Guillem git at videolan.org
Wed Mar 7 11:47:40 CET 2018


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

LibVLC: Media

Don't override options set by the LibVLC user.

> https://code.videolan.org/videolan/vlc-android/commit/588434e69a2b7c1c45581a3c528ed8473aee92b9
---

 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