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

Thomas Guillem git at videolan.org
Wed Mar 7 15:22:51 CET 2018


vlc-android | branch: 3.0.x | Thomas Guillem <thomas at gllm.fr> | Wed Mar  7 11:47:26 2018 +0100| [8676a199302e69042b306643ae27f7dd6c808364] | committer: Geoffrey Métais

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

(cherry picked from commit 142154e3abbad0d969dd8c5cd24652f275884a40)

> https://code.videolan.org/videolan/vlc-android/commit/8676a199302e69042b306643ae27f7dd6c808364
---

 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