[Android] LibVLC: speed up video track transition

Thomas Guillem git at videolan.org
Thu Jun 23 19:55:57 CEST 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 23 19:54:53 2016 +0200| [496813c57f22fe48524229410ddfc370787f1e3d] | committer: Thomas Guillem

LibVLC: speed up video track transition

> https://code.videolan.org/videolan/vlc-android/commit/496813c57f22fe48524229410ddfc370787f1e3d
---

 libvlc/src/org/videolan/libvlc/MediaPlayer.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 145fdbd..94cb72f 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -578,6 +578,13 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
                 for (MediaPlayer.TrackDescription track : tracks) {
                     if (track.id != -1) {
                         setVideoTrack(track.id);
+                        /* HACK: flush when activating a video track. This will force an
+                         * I-Frame to be displayed right away. */
+                        if (isSeekable()) {
+                            long time = getTime();
+                            if (time > 0)
+                                setTime(time);
+                        }
                         break;
                     }
                 }



More information about the Android mailing list