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.
This commit is contained in:
Sebastian Dröge 2015-06-18 14:38:04 +02:00
parent c51b012991
commit 6b2800e324
2 changed files with 15 additions and 0 deletions

View file

@ -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)
{

View file

@ -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);