<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Will it work if the lib is not present? <br></div><div><br></div><div>On Thu, Dec 3, 2020, at 21:31, Sean McGovern wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="auto"><div>And then it is as simple as comparing the symbol to null.<br></div><div><br></div><div>-- Sean McGovern<br></div></div><div><br></div><div class="qt-gmail_quote"><div dir="ltr" class="qt-gmail_attr">On Thu., Dec. 3, 2020, 15:22 Sean McGovern, <<a href="mailto:gseanmcg@gmail.com">gseanmcg@gmail.com</a>> wrote:<br></div><blockquote class="qt-gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;"><div dir="auto"><div dir="auto">Hi Thomas,<br></div><div dir="auto"><br></div><div>When you link, you should be able to mark the libaudio.so as a weak dependancy(sp?) as well.<br></div><div dir="auto"><br></div><div dir="auto"><div>Can the linker for Android do this? I haven't checked.<br></div><div><br></div><div dir="auto">-- Sean McGovern<br></div></div></div><div><br></div><div class="qt-gmail_quote"><div dir="ltr" class="qt-gmail_attr">On Thu., Dec. 3, 2020, 14:29 Thomas Guillem, <<a href="mailto:thomas@gllm.fr" target="_blank" rel="noreferrer">thomas@gllm.fr</a>> wrote:<br></div><blockquote class="qt-gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;"><div>Hello,<br></div><div> <br></div><div> How do you do that? Knowing that libaaudio.so is not necessarily present.<br></div><div> <br></div><div> On Thu, Dec 3, 2020, at 18:28, Rémi Denis-Courmont wrote:<br></div><div> > Le torstaina 3. joulukuuta 2020, 19.16.04 EET Thomas Guillem a écrit :<br></div><div> > > <a href="https://developer.android.com/ndk/guides/audio/aaudio/aaudio" rel="noreferrer noreferrer noreferrer" target="_blank">https://developer.android.com/ndk/guides/audio/aaudio/aaudio</a><br></div><div> > > <br></div><div> > > AAudio is a native PCM-only audio API starting Android 8.0 (but enabled<br></div><div> > > in VLC starting Android 9.0 due to some bugs).<br></div><div> > > <br></div><div> > > Having tested it with few device. The latency reported by this new API is<br></div><div> > > correct and without any irregularity, contrary to the<br></div><div> > > AudioTrack.getTimeStamp() API that is very broken.<br></div><div> > > <br></div><div> > > Plus side, a huge gain of performance due to the absence of JNI<br></div><div> > > C->JAVA->C++. ---<br></div><div> > > modules/audio_output/Makefile.am | 1 +<br></div><div> > > modules/audio_output/android/aaudio.c | 625 ++++++++++++++++++++++++++<br></div><div> > > modules/audio_output/android/device.c | 5 +<br></div><div> > > modules/audio_output/android/device.h | 3 +<br></div><div> > > 4 files changed, 634 insertions(+)<br></div><div> > > create mode 100644 modules/audio_output/android/aaudio.c<br></div><div> > > <br></div><div> > > diff --git a/modules/audio_output/Makefile.am<br></div><div> > > b/modules/audio_output/Makefile.am index 35b11e7e3aa..f4d38d9ff68 100644<br></div><div> > > --- a/modules/audio_output/Makefile.am<br></div><div> > > +++ b/modules/audio_output/Makefile.am<br></div><div> > > @@ -3,6 +3,7 @@ aout_LTLIBRARIES =<br></div><div> > > <br></div><div> > > libandroid_audio_plugin_la_SOURCES = audio_output/android/audiotrack.c \<br></div><div> > > audio_output/android/opensles.c \<br></div><div> > > + audio_output/android/aaudio.c \<br></div><div> > > audio_output/android/device.c audio_output/android/device.h \<br></div><div> > > video_output/android/utils.c video_output/android/utils.h<br></div><div> > > libandroid_audio_plugin_la_LIBADD = $(LIBDL) $(LIBM)<br></div><div> > > diff --git a/modules/audio_output/android/aaudio.c<br></div><div> > > b/modules/audio_output/android/aaudio.c new file mode 100644<br></div><div> > > index 00000000000..15c3c193b3f<br></div><div> > > --- /dev/null<br></div><div> > > +++ b/modules/audio_output/android/aaudio.c<br></div><div> > > @@ -0,0 +1,625 @@<br></div><div> > > +/**************************************************************************<br></div><div> > > *** + * aaudio.c: Android AAudio audio stream module<br></div><div> > > +<br></div><div> > > ***************************************************************************<br></div><div> > > ** + * Copyright © 2018-2020 VLC authors, VideoLAN and VideoLabs<br></div><div> > > + *<br></div><div> > > + * Authors: Romain Vimont <<a href="mailto:rom1v@videolabs.io" rel="noreferrer noreferrer" target="_blank">rom1v@videolabs.io</a>><br></div><div> > > + * Thomas Guillem <<a href="mailto:thomas@gllm.fr" rel="noreferrer noreferrer" target="_blank">thomas@gllm.fr</a>><br></div><div> > > + *<br></div><div> > > + * This program is free software; you can redistribute it and/or modify it<br></div><div> > > + * under the terms of the GNU Lesser General Public License as published by<br></div><div> > > + * the Free Software Foundation; either version 2.1 of the License, or + *<br></div><div> > > (at your option) any later version.<br></div><div> > > + *<br></div><div> > > + * This program is distributed in the hope that it will be useful,<br></div><div> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br></div><div> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br></div><div> > > + * GNU Lesser General Public License for more details.<br></div><div> > > + *<br></div><div> > > + * You should have received a copy of the GNU Lesser General Public License<br></div><div> > > + * along with this program; if not, write to the Free Software Foundation,<br></div><div> > > + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +<br></div><div> > > ***************************************************************************<br></div><div> > > **/ +<br></div><div> > > +#ifdef HAVE_CONFIG_H<br></div><div> > > +# include "config.h"<br></div><div> > > +#endif<br></div><div> > > +<br></div><div> > > +#include <vlc_common.h><br></div><div> > > +#include <vlc_plugin.h><br></div><div> > > +#include <vlc_aout.h><br></div><div> > > +#include <assert.h><br></div><div> > > +#include <dlfcn.h><br></div><div> > > +<br></div><div> > > +#include "device.h"<br></div><div> > > +<br></div><div> > > +#include <aaudio/AAudio.h><br></div><div> > > +<br></div><div> > > +struct sys<br></div><div> > > +{<br></div><div> > > + AAudioStream *as;<br></div><div> > > +<br></div><div> > > + jobject dp;<br></div><div> > > + float volume;<br></div><div> > > + bool muted;<br></div><div> > > +<br></div><div> > > + audio_sample_format_t fmt;<br></div><div> > > + int64_t frames_written;<br></div><div> > > + int64_t frames_flush_pos;<br></div><div> > > + bool error;<br></div><div> > > +};<br></div><div> > > +<br></div><div> > > +/* dlopen/dlsym symbols */<br></div><div> > > +static struct {<br></div><div> > > + void *handle;<br></div><div> > > + aaudio_result_t (*AAudio_createStreamBuilder)(AAudioStreamBuilder<br></div><div> > > **); + const char <br></div><div> > > *(*AAudio_convertResultToText)(aaudio_result_t); + void <br></div><div> > > (*AAudioStreamBuilder_setFormat)(AAudioStreamBuilder *, aaudio_format_t); +<br></div><div> > > void <br></div><div> > > (*AAudioStreamBuilder_setChannelCount)(AAudioStreamBuilder *, int32_t); + <br></div><div> > > void <br></div><div> > > (*AAudioStreamBuilder_setBufferCapacityInFrames)(AAudioStreamBuilder *,<br></div><div> > > int32_t); + void <br></div><div> > > (*AAudioStreamBuilder_setPerformanceMode)(AAudioStreamBuilder *,<br></div><div> > > aaudio_performance_mode_t); + void <br></div><div> > > (*AAudioStreamBuilder_setSessionId)(AAudioStreamBuilder *,<br></div><div> > > aaudio_session_id_t); + void <br></div><div> > > (*AAudioStreamBuilder_setUsage)(AAudioStreamBuilder *, aaudio_usage_t); + <br></div><div> > > aaudio_result_t <br></div><div> > > (*AAudioStreamBuilder_openStream)(AAudioStreamBuilder *, AAudioStream **);<br></div><div> > > + void <br></div><div> > > (*AAudioStreamBuilder_delete)(AAudioStreamBuilder *); + aaudio_result_t <br></div><div> > > (*AAudioStream_requestStart)(AAudioStream *); + aaudio_result_t <br></div><div> > > (*AAudioStream_requestStop)(AAudioStream *); + aaudio_result_t <br></div><div> > > (*AAudioStream_requestPause)(AAudioStream *); + aaudio_result_t <br></div><div> > > (*AAudioStream_requestFlush)(AAudioStream *); + int32_t <br></div><div> > > (*AAudioStream_getSampleRate)(AAudioStream *); + aaudio_result_t <br></div><div> > > (*AAudioStream_getTimestamp)(AAudioStream *, clockid_t, + <br></div><div> > > int64_t *framePosition, int64_t<br></div><div> > > *timeNanoseconds); + aaudio_result_t <br></div><div> > > (*AAudioStream_write)(AAudioStream *, void *, int32_t numFrames, int64_t<br></div><div> > > timeoutNanoseconds); + aaudio_result_t <br></div><div> > > (*AAudioStream_close)(AAudioStream *);<br></div><div> > > + aaudio_stream_state_t (*AAudioStream_getState)(AAudioStream *);<br></div><div> > > + aaudio_result_t (*AAudioStream_waitForStateChange)(AAudioStream<br></div><div> > > *, aaudio_stream_state_t current_state, aaudio_stream_state_t *nextState,<br></div><div> > > int64_t timeoutNanoseconds); + aaudio_session_id_t <br></div><div> > > (*AAudioStream_getSessionId)(AAudioStream *); +} vt;<br></div><div> > <br></div><div> > Weak symbols would probably be a lot simpler than dlsym() calls here.<br></div><div> > <br></div><div> > -- <br></div><div> > レミ・デニ-クールモン<br></div><div> > <a href="http://www.remlab.net/" rel="noreferrer noreferrer noreferrer" target="_blank">http://www.remlab.net/</a><br></div><div> > <br></div><div> > <br></div><div> > <br></div><div> > _______________________________________________<br></div><div> > vlc-devel mailing list<br></div><div> > To unsubscribe or modify your subscription options:<br></div><div> > <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer noreferrer noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div><div> _______________________________________________<br></div><div> vlc-devel mailing list<br></div><div> To unsubscribe or modify your subscription options:<br></div><div> <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer noreferrer noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote></div></blockquote></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><br></div></body></html>