From: Sebastian Dröge Date: Thu, 18 Jun 2015 12:38:04 +0000 (+0200) Subject: androidmedia: Allow the application to provide the Java VM X-Git-Tag: 1.6.0~525 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b2800e324ec237ce086cdf28624292f0af05a43;p=platform%2Fupstream%2Fgst-plugins-bad.git androidmedia: Allow the application to provide the Java VM In JNI_OnLoad() we will already get the Java VM passed and could just directly use that. gstreamer_android-1.0.c will now provide this to us. Reason for this is that apparently not all Android system are providing the JNI functions to get the currently running Java VMs, so we would fail to get. With this we will always be able to get the Java VM on such systems. --- diff --git a/sys/androidmedia/gstjniutils.c b/sys/androidmedia/gstjniutils.c index 1583e14..b21ae51 100644 --- a/sys/androidmedia/gstjniutils.c +++ b/sys/androidmedia/gstjniutils.c @@ -628,6 +628,11 @@ gst_amc_jni_initialize_java_vm (void) jsize n_vms; gint ret; + if (java_vm) { + GST_DEBUG ("Java VM already provided by the application"); + return TRUE; + } + /* Returns TRUE if we can safely * a) get the current VMs and * b) start a VM if none is started yet @@ -757,6 +762,14 @@ gst_amc_jni_initialize_internal (gpointer data) return gst_amc_jni_initialize_java_vm ()? GINT_TO_POINTER (1) : NULL; } +/* Allow the application to set the Java VM */ +void +gst_amc_jni_set_java_vm (JavaVM * vm) +{ + GST_DEBUG ("Application provides Java VM %p", vm); + java_vm = vm; +} + gboolean gst_amc_jni_initialize (void) { diff --git a/sys/androidmedia/gstjniutils.h b/sys/androidmedia/gstjniutils.h index ef0f14b..a6bc68a 100644 --- a/sys/androidmedia/gstjniutils.h +++ b/sys/androidmedia/gstjniutils.h @@ -99,6 +99,8 @@ void gst_amc_jni_set_error (JNIEnv * env, gint code, const gchar * format, ...); +void gst_amc_jni_set_java_vm (JavaVM *java_vm); + gboolean gst_amc_jni_initialize (void); gboolean gst_amc_jni_is_vm_started (void);