[Android] LibVLC: Don't activate a video track if surfaces are not ready
Thomas Guillem
git at videolan.org
Thu Mar 31 16:53:46 CEST 2016
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 31 16:53:24 2016 +0200| [76accee7d78e34fd8a3103d453343fb56f2878dc] | committer: Thomas Guillem
LibVLC: Don't activate a video track if surfaces are not ready
> https://code.videolan.org/videolan/vlc-android/commit/76accee7d78e34fd8a3103d453343fb56f2878dc
---
libvlc/src/org/videolan/libvlc/MediaPlayer.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index edf2b29..e0e09b1 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -560,7 +560,11 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
* @return true on success.
*/
public boolean setVideoTrack(int index) {
- return nativeSetVideoTrack(index);
+ /* Don't activate a video track is surfaces are not ready */
+ if (index == -1 || (mWindow.areViewsAttached() && !mWindow.areSurfacesWaiting())) {
+ return nativeSetVideoTrack(index);
+ } else
+ return false;
}
/**
More information about the Android
mailing list