[Android] [PATCH] jni: fix aout args

Thomas Guillem thomas at gllm.fr
Tue Dec 2 11:51:14 CET 2014


Don't try to load any audio module for AOUT_AUDIOTRACK_JAVA.
The good module (amem) will be loaded when callbacks are set.
---
 libvlc/jni/libvlcjni.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index b2c0cce..94b216c 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -262,7 +262,7 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
     //only use OpenSLES if java side says we can
     jclass cls = (*env)->GetObjectClass(env, thiz);
     jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
-    bool use_opensles = (*env)->CallIntMethod(env, thiz, methodId) == AOUT_OPENSLES;
+    int aout = (*env)->CallIntMethod(env, thiz, methodId);
 
     methodId = (*env)->GetMethodID(env, cls, "getVout", "()I");
     int vout = (*env)->CallIntMethod(env, thiz, methodId);
@@ -338,7 +338,8 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
         (networkCaching > 0) ? networkCachingstr : "",
 
         /* Android audio API is a mess */
-        use_opensles ? "--aout=opensles" : "--aout=android_audiotrack",
+        aout == AOUT_OPENSLES ? "--aout=opensles" :
+            (aout == AOUT_AUDIOTRACK ? "--aout=android_audiotrack" : "--aout=dummy"),
 
         /* Android video API is a mess */
         vout == VOUT_ANDROID_WINDOW ? "--vout=androidwindow" :
-- 
2.1.3



More information about the Android mailing list