[Android] Media: disable file/network caching hack for MediaCodec

Thomas Guillem git at videolan.org
Fri Dec 11 18:12:45 CET 2015


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec  3 09:40:20 2015 +0100| [4078d1bc37f3d911cbed2761a294b8b7c3c40b9c] | committer: Thomas Guillem

Media: disable file/network caching hack for MediaCodec

> https://code.videolan.org/videolan/vlc-android/commit/4078d1bc37f3d911cbed2761a294b8b7c3c40b9c
---

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

diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 90983af..7d2c5c2 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -21,6 +21,7 @@
 package org.videolan.libvlc;
 
 import android.net.Uri;
+import android.util.Log;
 
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.libvlc.util.HWDecoderUtil;
@@ -617,17 +618,20 @@ public class Media extends VLCObject<Media.Event> {
             return;
         }
 
-        /*
-         * Set higher caching values if using iomx decoding, since some omx
-         * decoders have a very high latency, and if the preroll data isn't
-         * enough to make the decoder output a frame, the playback timing gets
-         * started too soon, and every decoded frame appears to be too late.
-         * On Nexus One, the decoder latency seems to be 25 input packets
-         * 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 (!AndroidUtil.isJellyBeanOrLater()) {
+            /*
+             * Set higher caching values if using iomx decoding, since some omx
+             * decoders have a very high latency, and if the preroll data isn't
+             * enough to make the decoder output a frame, the playback timing gets
+             * started too soon, and every decoded frame appears to be too late.
+             * On Nexus One, the decoder latency seems to be 25 input packets
+             * 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");
+            Log.i(TAG, "file/network caching for hw decoders");
+        }
 
         final StringBuilder sb = new StringBuilder(":codec=");
         if (decoder == HWDecoderUtil.Decoder.MEDIACODEC)



More information about the Android mailing list