[vlc-commits] [Git][videolan/vlc][master] 3 commits: android/opensles: remove dead code

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Oct 30 15:38:22 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
510fab0c by Steve Lhomme at 2024-10-30T15:26:35+00:00
android/opensles: remove dead code

VLC 4 requires Android 21. So CHECK_NATIVE_SAMPLE_RATE is always 0.

- - - - -
d1189c6f by Steve Lhomme at 2024-10-30T15:26:35+00:00
android: remove unused libandroid_env from some modules

- - - - -
576869dc by Steve Lhomme at 2024-10-30T15:26:35+00:00
android/audioformat_jni: remove unused GET_ENV

It was never used in 189d43538940a70afaed241ed22e9f069cb44bd7

- - - - -


5 changed files:

- modules/audio_output/Makefile.am
- modules/audio_output/android/aaudio.c
- modules/audio_output/android/audioformat_jni.c
- modules/audio_output/android/device.c
- modules/audio_output/android/opensles.c


Changes:

=====================================
modules/audio_output/Makefile.am
=====================================
@@ -16,7 +16,7 @@ noinst_LTLIBRARIES += \
 endif
 
 libopensles_android_plugin_la_SOURCES = audio_output/android/opensles.c
-libopensles_android_plugin_la_LIBADD = libandroid_env.la $(LIBDL) $(LIBM)
+libopensles_android_plugin_la_LIBADD = $(LIBDL) $(LIBM)
 
 libandroid_audiotrack_plugin_la_SOURCES = audio_output/android/audiotrack.c audio_output/android/device.h
 libandroid_audiotrack_plugin_la_LIBADD = libandroid_env.la \


=====================================
modules/audio_output/android/aaudio.c
=====================================
@@ -33,7 +33,6 @@
 
 #include "device.h"
 #include "dynamicsprocessing_jni.h"
-#include "../../video_output/android/env.h"
 
 #include <aaudio/AAudio.h>
 


=====================================
modules/audio_output/android/audioformat_jni.c
=====================================
@@ -33,7 +33,6 @@
 #include "audioformat_jni.h"
 
 #define THREAD_NAME "android_audio"
-#define GET_ENV() android_getEnv(VLC_OBJECT(stream), THREAD_NAME)
 #define JNI_CALL(what, obj, method, ...) (*env)->what(env, obj, method, ##__VA_ARGS__)
 #define JNI_CALL_INT(obj, method, ...) JNI_CALL(CallIntMethod, obj, method, ##__VA_ARGS__)
 #define JNI_CALL_VOID(obj, method, ...) JNI_CALL(CallVoidMethod, obj, method, ##__VA_ARGS__)


=====================================
modules/audio_output/android/device.c
=====================================
@@ -36,7 +36,6 @@
 
 #include "device.h"
 #include "audioformat_jni.h"
-#include "../video_output/android/env.h"
 
 /* There is an undefined behavior when configuring AudioTrack with SPDIF or
  * more than 2 channels when there is no HDMI out. It may succeed and the


=====================================
modules/audio_output/android/opensles.c
=====================================
@@ -33,8 +33,6 @@
 #include <dlfcn.h>
 #include <math.h>
 
-#include "../../video_output/android/env.h"
-
 // For native audio
 #include <SLES/OpenSLES.h>
 #include <SLES/OpenSLES_Android.h>
@@ -55,8 +53,6 @@
         goto error; \
     }
 
-#define CHECK_NATIVE_SAMPLE_RATE (__ANDROID_API__ < 21)
-
 typedef SLresult (*slCreateEngine_t)(
         SLObjectItf*, SLuint32, const SLEngineOption*, SLuint32,
         const SLInterfaceID*, const SLboolean*);
@@ -327,29 +323,6 @@ static void PlayedCallback (SLAndroidSimpleBufferQueueItf caller, void *pContext
     vlc_mutex_unlock(&sys->lock);
 }
 
-#if CHECK_NATIVE_SAMPLE_RATE
-static int aout_get_native_sample_rate(audio_output_t *aout)
-{
-    JNIEnv *p_env;
-    if (!(p_env = android_getEnv(VLC_OBJECT(aout), "opensles")))
-        return -1;
-    jclass cls = (*p_env)->FindClass (p_env, "android/media/AudioTrack");
-    if ((*p_env)->ExceptionCheck(p_env))
-    {
-        (*p_env)->ExceptionClear(p_env);
-        return -1;
-    }
-    jmethodID method = (*p_env)->GetStaticMethodID(p_env, cls,
-                                                   "getNativeOutputSampleRate",
-                                                   "(I)I");
-    /* 3 for AudioManager.STREAM_MUSIC */
-    int sample_rate = (*p_env)->CallStaticIntMethod(p_env, cls, method, 3);
-    (*p_env)->DeleteLocalRef(p_env, cls);
-    msg_Dbg(aout, "%s: %d", __func__, sample_rate);
-    return sample_rate;
-}
-#endif
-
 static int Open (vlc_object_t *obj)
 {
     audio_output_t *aout = (audio_output_t *)obj;
@@ -503,17 +476,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     const SLInterfaceID ids2[] = { sys->SL_IID_ANDROIDSIMPLEBUFFERQUEUE, sys->SL_IID_VOLUME };
     static const SLboolean req2[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE };
 
-#if CHECK_NATIVE_SAMPLE_RATE
-    if (aout_get_native_sample_rate(aout) < (int)fmt->i_rate) {
-        // Don't try to play back a sample rate higher than the native one,
-        // since OpenSL ES will try to use the fast path, which AudioFlinger
-        // will reject (fast path can't do resampling), and will end up with
-        // too small buffers for the resampling. See http://b.android.com/59453
-        // for details. This bug is fixed in 5.0
-        result = SL_RESULT_UNKNOWN_ERROR;
-    }
-    else
-#endif
         result = CreateAudioPlayer(sys->engineEngine, &sys->playerObject, &audioSrc,
                                     &audioSnk, sizeof(ids2) / sizeof(*ids2),
                                     ids2, req2);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b940068a192bc3a3f1edba759ecfae6746a00f0f...576869dcf66daeb1f8646c14c62121566e1d7e9f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b940068a192bc3a3f1edba759ecfae6746a00f0f...576869dcf66daeb1f8646c14c62121566e1d7e9f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list