[vlc-devel] [PATCH 2/3] android: update with last jni_LockAndGetAndroidJavaSurface changes
Thomas Guillem
thomas at gllm.fr
Wed Apr 8 17:30:54 CEST 2015
if jni_LockAndGetAndroidJavaSurface returns NULL, no need to unlock.
---
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 94c0113..f58b2b0 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -625,11 +625,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..71dd5cc 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 (!surf)
+ 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 (!surf)
+ 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;
--
2.1.3
More information about the vlc-devel
mailing list