summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-06-18 10:43:53 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-06-18 10:45:24 +0200
commitade625111e42b64fed0145066f06593a235e75cd (patch)
tree588a6967fa4c59f67e9312b2c79a3e9137b8712a /sys
parentbdcaf8f5eeead76c3a2d6825edcc4176d59e6064 (diff)
downloadgstreamer-plugins-bad-ade625111e42b64fed0145066f06593a235e75cd.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/androidmedia/gstjniutils.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/androidmedia/gstjniutils.c b/sys/androidmedia/gstjniutils.c
index b2be36655..c842db1d8 100644
--- a/sys/androidmedia/gstjniutils.c
+++ b/sys/androidmedia/gstjniutils.c
@@ -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)