[vlc-commits] android_window: fix deadlock if android surface won't be created

Thomas Guillem git at videolan.org
Wed Jan 21 16:27:51 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jan 21 14:11:02 2015 +0000| [43c9fa302c7238b25d0cd54a499470d04c6f8f43] | committer: Jean-Baptiste Kempf

android_window: fix deadlock if android surface won't be created

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43c9fa302c7238b25d0cd54a499470d04c6f8f43
---

 modules/video_output/android/android_window.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/video_output/android/android_window.c b/modules/video_output/android/android_window.c
index 20abe80..7316fab 100644
--- a/modules/video_output/android/android_window.c
+++ b/modules/video_output/android/android_window.c
@@ -74,6 +74,7 @@ extern jobject jni_LockAndGetAndroidJavaSurface();
 extern jobject jni_LockAndGetSubtitlesSurface();
 extern void  jni_UnlockAndroidSurface();
 
+extern bool jni_IsVideoPlayerActivityCreated();
 extern void  jni_SetSurfaceLayout(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den);
 extern int jni_ConfigureSurface(jobject jsurf, int width, int height, int hal, bool *configured);
 extern int jni_GetWindowSize(int *width, int *height);
@@ -618,6 +619,13 @@ static int Open(vlc_object_t *p_this)
     if (vout_display_IsWindowed(vd))
         return VLC_EGENERIC;
 
+    /* XXX: android_window use a surface created by VideoPlayerActivity to
+     * alloc pictures. Don't try to open the vout if this activity is not
+     * created. This need to be replaced by something like var_CreateGetAddress
+     * (vd, "drawable-android") in the future. */
+    if (!jni_IsVideoPlayerActivityCreated())
+        return VLC_EGENERIC;
+
     /* Allocate structure */
     vd->sys = sys = (struct vout_display_sys_t*)calloc(1, sizeof(*sys));
     if (!sys)



More information about the vlc-commits mailing list