amc: actually use the provided application class loader

For the camera and sensor

Fixes a couple of ClassNotFound java exceptions when initializing GStreamer
off the main thread.
This commit is contained in:
Matthew Waters 2017-08-31 18:56:37 +10:00
parent 3f2a3d0db9
commit 4d2382fb27
3 changed files with 12 additions and 5 deletions

View file

@ -1590,8 +1590,8 @@ _init_classes (void)
if (!org_freedesktop_gstreamer_androidmedia_gstahccallback.klass) {
org_freedesktop_gstreamer_androidmedia_gstahccallback.klass =
gst_amc_jni_get_class (env, &err,
"org/freedesktop/gstreamer/androidmedia/GstAhcCallback");
gst_amc_jni_get_application_class (env,
"org/freedesktop/gstreamer/androidmedia/GstAhcCallback", &err);
}
if (!org_freedesktop_gstreamer_androidmedia_gstahccallback.klass)
goto failed;

View file

@ -569,8 +569,8 @@ _init_classes (void)
/* org.freedesktop.gstreamer.androidmedia.GstAhsCallback */
if (!org_freedesktop_gstreamer_androidmedia_gstahscallback.klass) {
org_freedesktop_gstreamer_androidmedia_gstahscallback.klass =
gst_amc_jni_get_class (env, &err,
"org/freedesktop/gstreamer/androidmedia/GstAhsCallback");
gst_amc_jni_get_application_class (env,
"org/freedesktop/gstreamer/androidmedia/GstAhsCallback", &err);
}
if (!org_freedesktop_gstreamer_androidmedia_gstahscallback.klass)
goto failed;

View file

@ -869,6 +869,13 @@ gst_amc_jni_get_application_class (JNIEnv * env, const gchar * name,
jclass class_loader_cls = NULL;
jmethodID load_class_id = 0;
GST_LOG ("attempting to retrieve class %s", name);
if (!get_class_loader) {
g_set_error (err, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
"Could not retreive application class loader function");
goto done;
}
class_loader = get_class_loader ();
if (!class_loader) {
@ -887,7 +894,7 @@ gst_amc_jni_get_application_class (JNIEnv * env, const gchar * name,
load_class_id =
gst_amc_jni_get_method_id (env, err, class_loader_cls, "loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;");
if (!class_loader_cls) {
if (!load_class_id) {
goto done;
}