[vlc-commits] android: update with last jni_LockAndGetAndroidJavaSurface changes

Thomas Guillem git at videolan.org
Thu Apr 9 17:41:11 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Apr  8 17:16:05 2015 +0200| [6ce78b99b69ed221d80c494723719db1b2b55006] | committer: Thomas Guillem

android: update with last jni_LockAndGetAndroidJavaSurface changes

if jni_LockAndGetAndroidJavaSurface returns NULL, no need to unlock.

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

 modules/codec/omxil/android_mediacodec.c      |    2 +-
 modules/codec/omxil/omxil.c                   |    1 -
 modules/video_output/android/android_window.c |    4 ++++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 73e0b4f..3fb5680 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -628,11 +628,11 @@ loopclean:
                 goto error;
             }
             p_dec->fmt_out.i_codec = VLC_CODEC_ANDROID_OPAQUE;
+            jni_UnlockAndroidSurface();
         } else {
             msg_Warn(p_dec, "Failed to get the Android Surface, disabling direct rendering.");
             p_sys->direct_rendering = false;
         }
-        jni_UnlockAndroidSurface();
     }
     if (!p_sys->direct_rendering) {
         (*env)->CallVoidMethod(env, p_sys->codec, jfields.configure, format, NULL, NULL, 0);
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 1f6ebf4..fd1d6f0 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -2060,7 +2060,6 @@ static void HwBuffer_Init( decoder_t *p_dec, OmxPort *p_port )
 
     surf = jni_LockAndGetAndroidJavaSurface();
     if( !surf ) {
-        jni_UnlockAndroidSurface();
         msg_Warn( p_dec, "jni_LockAndGetAndroidJavaSurface failed" );
         goto error;
     }
diff --git a/modules/video_output/android/android_window.c b/modules/video_output/android/android_window.c
index 5d183c0..b7719b1 100644
--- a/modules/video_output/android/android_window.c
+++ b/modules/video_output/android/android_window.c
@@ -578,6 +578,8 @@ static int SetupWindowSurface(vout_display_sys_t *sys, unsigned i_pic_count)
 {
     int err;
     jobject jsurf = jni_LockAndGetAndroidJavaSurface();
+    if (!jsurf)
+        return -1;
     err = AndroidWindow_SetSurface(sys, sys->p_window, jsurf);
     jni_UnlockAndroidSurface();
     err = err == 0 ? AndroidWindow_Setup(sys, sys->p_window, i_pic_count) : err;
@@ -588,6 +590,8 @@ static int SetupWindowSubtitleSurface(vout_display_sys_t *sys)
 {
     int err;
     jobject jsurf = jni_LockAndGetSubtitlesSurface();
+    if (!jsurf)
+        return -1;
     err = AndroidWindow_SetSurface(sys, sys->p_sub_window, jsurf);
     jni_UnlockAndroidSurface();
     err = err == 0 ? AndroidWindow_Setup(sys, sys->p_sub_window, 1) : err;



More information about the vlc-commits mailing list