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