playback/player: android: check return values from JNI methods in 'JNI_OnLoad'

This commit is contained in:
Alex Moreno 2015-05-06 10:38:25 +08:00 committed by Sebastian Dröge
parent c3928830cf
commit 261081aade

View file

@ -474,8 +474,17 @@ JNI_OnLoad (JavaVM * vm, void *reserved)
return 0;
}
jclass klass = (*env)->FindClass (env, "org/freedesktop/gstreamer/Player");
(*env)->RegisterNatives (env, klass, native_methods,
G_N_ELEMENTS (native_methods));
if (!klass) {
__android_log_print (ANDROID_LOG_ERROR, "GstPlayer",
"Could not retrieve class org.freedesktop.gstreamer.Player");
return 0;
}
if ((*env)->RegisterNatives (env, klass, native_methods,
G_N_ELEMENTS (native_methods))) {
__android_log_print (ANDROID_LOG_ERROR, "GstPlayer",
"Could not register native methods for org.freedesktop.gstreamer.Player");
return 0;
}
pthread_key_create (&current_jni_env, detach_current_thread);