[Android] jniloader: add more logs in case of error
Thomas Guillem
git at videolan.org
Fri Oct 27 18:04:53 CEST 2017
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Oct 27 18:04:43 2017 +0200| [20f2047a24469d75cb87e690b4e5ed59a8bc0e03] | committer: Thomas Guillem
jniloader: add more logs in case of error
> https://code.videolan.org/videolan/vlc-android/commit/20f2047a24469d75cb87e690b4e5ed59a8bc0e03
---
libvlc/jni/loader/jniloader.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libvlc/jni/loader/jniloader.c b/libvlc/jni/loader/jniloader.c
index 487a6d688..b7d338b59 100644
--- a/libvlc/jni/loader/jniloader.c
+++ b/libvlc/jni/loader/jniloader.c
@@ -18,6 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <dlfcn.h>
+#include <stdio.h>
#include "jniloader.h"
/* jniloader.so is a shared C library used to receive JNI_OnLoad callback.
@@ -30,17 +31,29 @@ int JNI_OnLoad(JavaVM* vm, void* reserved)
JNIEnv *env;
if ((*vm)->GetEnv(vm, (void**) &env, VLC_JNI_VERSION) != JNI_OK)
+ {
+ fprintf(stderr, "GetEnv failed\n");
return -1;
+ }
int (*load)(JavaVM *, JNIEnv*);
load = dlsym(RTLD_DEFAULT, "VLCJNI_OnLoad");
if (!load || load(vm, env) != 0)
+ {
+ if (!load)
+ fprintf(stderr, "could not find VLCJNI_OnLoad\n");
+ else
+ fprintf(stderr, "VLCJNI_OnLoad failed\n");
return -1;
+ }
/* MediaLibraryJNI_OnLoad is not mandatory */
load = dlsym(RTLD_DEFAULT, "MediaLibraryJNI_OnLoad");
if (load && load(vm, env) != 0)
+ {
+ fprintf(stderr, "MediaLibraryJNI_OnLoad failed\n");
return -1;
+ }
return VLC_JNI_VERSION;
}
More information about the Android
mailing list