androidmedia: Don't fail if JNI_CreateJavaVM can't be found

We only need that if no Java VM is running yet, and all usual cases,
i.e. when calling GStreamer from an actual Android app, there will already
be a Java VM we can just use.

It seems like some phones come without that symbol, let's hope they come
with the other symbol but for now don't make a missing JNI_CreateJavaVM fatal.
This commit is contained in:
Sebastian Dröge 2015-06-18 10:43:53 +02:00
parent bdcaf8f5ee
commit ade625111e

View file

@ -531,8 +531,11 @@ load_java_module (const gchar * name)
goto load_failed;
if (!g_module_symbol (java_module, "JNI_CreateJavaVM",
(gpointer *) & create_java_vm))
goto symbol_error;
(gpointer *) & create_java_vm)) {
GST_ERROR ("Could not find 'JNI_CreateJavaVM' in '%s': %s",
GST_STR_NULL (name), g_module_error ());
create_java_vm = NULL;
}
if (!g_module_symbol (java_module, "JNI_GetCreatedJavaVMs",
(gpointer *) & get_created_java_vms))
@ -648,7 +651,7 @@ gst_amc_jni_initialize_java_vm (void)
if (n_vms > 0) {
GST_DEBUG ("Successfully got existing Java VM %p", java_vm);
} else {
} else if (create_java_vm) {
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options[4];
@ -669,6 +672,9 @@ gst_amc_jni_initialize_java_vm (void)
GST_DEBUG ("Successfully created Java VM %p", java_vm);
started_java_vm = TRUE;
} else {
GST_ERROR ("JNI_CreateJavaVM not available");
java_vm = NULL;
}
if (java_vm == NULL)