[Android] MediaPlayer: wait vout destruction on surfaceDestroyed cb
Thomas Guillem
git at videolan.org
Thu Jul 2 14:54:26 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 2 14:53:57 2015 +0200| [f51e7637eb6c8e69ae437b3369c9793127f8b513] | committer: Thomas Guillem
MediaPlayer: wait vout destruction on surfaceDestroyed cb
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f51e7637eb6c8e69ae437b3369c9793127f8b513
---
libvlc/src/org/videolan/libvlc/MediaPlayer.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 790cf56..1921e2d 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -166,6 +166,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
private boolean mPlaying = false;
private boolean mPlayRequested = false;
private final AWindow mWindow = new AWindow(this);
+ private int mVoutCount = 0;
/**
* Create an empty MediaPlayer
@@ -258,7 +259,11 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
public synchronized void onSurfacesDestroyed(AWindow vout) {
if (mPlaying) {
setVideoTrackEnabled(false);
- /* TODO wait for no VOUT event */
+ while (mVoutCount > 0) {
+ try {
+ wait();
+ } catch (InterruptedException ignored) {}
+ }
}
}
@@ -440,6 +445,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
case Event.PositionChanged:
return new Event(eventType, arg2);
case Event.Vout:
+ mVoutCount = (int) arg1;
+ notify();
return new Event(eventType, arg1);
case Event.ESAdded:
case Event.ESDeleted:
More information about the Android
mailing list