[vlc-devel] [PATCH 3/3] android: remove jni_IsVideoPlayerActivityCreated

Thomas Guillem thomas at gllm.fr
Wed Apr 8 17:30:55 CEST 2015


VideoPlayer is now started when surfaces are available.

If no surfaces are available, don't wait for it, and return an error (and
fallback to audio only).
---
 modules/codec/omxil/android_mediacodec.c      | 6 +-----
 modules/codec/omxil/omxil.c                   | 3 +--
 modules/video_output/android/android_window.c | 8 --------
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index f58b2b0..803cef5 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -55,7 +55,6 @@ extern JNIEnv *jni_get_env(const char *name);
 extern jobject jni_LockAndGetAndroidJavaSurface();
 extern void jni_UnlockAndroidSurface();
 extern void jni_EventHardwareAccelerationError();
-extern bool jni_IsVideoPlayerActivityCreated();
 
 /* Implementation of a circular buffer of timestamps with overwriting
  * of older values. MediaCodec has only one type of timestamp, if a
@@ -578,10 +577,7 @@ loopclean:
         (*env)->DeleteLocalRef(env, bytebuf);
     }
 
-    /* If the VideoPlayerActivity is not started, MediaCodec opaque
-       direct rendering should be disabled since no surface will be
-       attached to the JNI. */
-    p_sys->direct_rendering = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr");
+    p_sys->direct_rendering = var_InheritBool(p_dec, CFG_PREFIX "dr");
 
     /* There is no way to rotate the video using direct rendering (and using a
      * SurfaceView) before  API 21 (Lollipop). Therefore, we deactivate direct
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index fd1d6f0..0176707 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -71,7 +71,6 @@
 extern JNIEnv *jni_get_env(const char *name);
 extern jobject jni_LockAndGetAndroidJavaSurface();
 extern void jni_UnlockAndroidSurface();
-extern bool jni_IsVideoPlayerActivityCreated();
 #endif
 
 /*****************************************************************************
@@ -1077,7 +1076,7 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
     p_sys->in.p_fmt = &p_dec->fmt_in;
     OMX_FIFO_INIT (&p_sys->out.fifo, pInputPortPrivate );
 #if defined(USE_IOMX)
-    p_sys->out.b_direct = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr");
+    p_sys->out.b_direct = var_InheritBool(p_dec, CFG_PREFIX "dr");
 #else
     p_sys->out.b_direct = false;
 #endif
diff --git a/modules/video_output/android/android_window.c b/modules/video_output/android/android_window.c
index 71dd5cc..1d2fa2b 100644
--- a/modules/video_output/android/android_window.c
+++ b/modules/video_output/android/android_window.c
@@ -72,7 +72,6 @@ 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);
@@ -638,13 +637,6 @@ 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)
-- 
2.1.3




More information about the vlc-devel mailing list