[Android] close java AudioTrack too

Sébastien Toque git at videolan.org
Sun Apr 22 01:08:12 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sun Apr 22 01:03:07 2012 +0200| [5493e508f64cf0f01374fb91540638720eeef91c] | committer: Sébastien Toque

close java AudioTrack too

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=5493e508f64cf0f01374fb91540638720eeef91c
---

 vlc-android/jni/aout.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/vlc-android/jni/aout.c b/vlc-android/jni/aout.c
index e9949e9..21b0807 100644
--- a/vlc-android/jni/aout.c
+++ b/vlc-android/jni/aout.c
@@ -171,6 +171,22 @@ void aout_close(void *opaque)
 
     JNIEnv *p_env;
     (*myVm)->AttachCurrentThread (myVm, &p_env, NULL);
+
+    // Call the close function.
+    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
+    jmethodID methodIdCloseAout = (*p_env)->GetMethodID (p_env, cls, "closeAout", "()V");
+    if (!methodIdCloseAout)
+        LOGE ("Method closeAout() could not be found!");
+    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdCloseAout);
+    if ((*p_env)->ExceptionCheck (p_env))
+    {
+        LOGE ("Unable to close audio player!");
+#ifndef NDEBUG
+        (*p_env)->ExceptionDescribe (p_env);
+#endif
+        (*p_env)->ExceptionClear (p_env);
+    }
+
     (*p_env)->DeleteGlobalRef (p_env, p_sys->buffer);
     (*myVm)->DetachCurrentThread (myVm);
     free (p_sys);



More information about the Android mailing list