diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2017-01-03 18:53:39 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-01-03 18:53:39 +0200 |
commit | eca6c356014b735b253a6c889b5ba6bdec88f32d (patch) | |
tree | dc5e59daf9f849c51268a4d2fe1efb86ff349543 /sys | |
parent | e31714691a2f9270d0d200c923dc4121183227e2 (diff) | |
download | gstreamer-plugins-bad-eca6c356014b735b253a6c889b5ba6bdec88f32d.tar.gz |
androidmedia: Actively request the Java VM from the application
This is more consistent with how we already request the application
class loader and other application resources elsewhere.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/androidmedia/gstjniutils.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/androidmedia/gstjniutils.c b/sys/androidmedia/gstjniutils.c index 4fe374719..a5b8e0d72 100644 --- a/sys/androidmedia/gstjniutils.c +++ b/sys/androidmedia/gstjniutils.c @@ -497,6 +497,29 @@ gst_amc_jni_detach_current_thread (void *env) } } +static JavaVM * +get_application_java_vm (void) +{ + GModule *module = NULL; + JavaVM *(*get_java_vm) (void); + JavaVM *vm = NULL; + + module = g_module_open (NULL, G_MODULE_BIND_LOCAL); + + if (!module) { + return NULL; + } + + if (g_module_symbol (module, "gst_android_get_java_vm", + (gpointer *) & get_java_vm) && get_java_vm) { + vm = get_java_vm (); + } + + g_module_close (module); + + return vm; +} + static gboolean check_nativehelper (void) { @@ -663,6 +686,12 @@ gst_amc_jni_initialize_java_vm (void) return initialize_classes (); } + java_vm = get_application_java_vm (); + if (java_vm) { + GST_DEBUG ("Java VM successfully requested from the application"); + return initialize_classes (); + } + /* Returns TRUE if we can safely * a) get the current VMs and * b) start a VM if none is started yet |