GithubHelp home page GithubHelp logo

Comments (10)

philburk avatar philburk commented on June 14, 2024 1

The reason to use dlopen() and dlsym() for linking AAudio is so that your app can be be loaded on new or old Android versions. If AAudio is not supported then dlopen() will return an error. Then your app can decide to use OpenSL ES or fail gracefully.

If you did not use dlopen() then your app would not even load on old versions of Android.

from android-audio-high-performance.

IgorGanapolsky avatar IgorGanapolsky commented on June 14, 2024

I am getting the same error in Android Studio 3.0:

Process: com.google.sample.com.google.sample.aaudio.play, PID: 27578
java.lang.UnsatisfiedLinkError: dlopen failed: library "libaaudio.so" not found

from android-audio-high-performance.

IgorGanapolsky avatar IgorGanapolsky commented on June 14, 2024

The problem is in /hello-aaudio/hello-aaudio.gradle:
'-DANDROID_PLATFORM=android-26'

this means the app cannot run on anything lower than Android O. If you try to recompile with android-21, it won't compile.

from android-audio-high-performance.

ggfan avatar ggfan commented on June 14, 2024

Yeah, it must run on Android-O: AAudio is only enabled on Android - O; and this version of the audio sample must be run on Android-O-Beta1 (documentation call it Developer Preview version 2 ): because the callback mechanism only enabled in Android O Image in the second developer preview ( released on 05/17/2017 ) or later formal release

from android-audio-high-performance.

IgorGanapolsky avatar IgorGanapolsky commented on June 14, 2024

@ggfan According to this talk at IO - https://www.youtube.com/watch?v=C0BPXZIvG-Q -
It should be possible to use aaudio_wrapper with dlsym to run on earlier platforms. Is that true?

from android-audio-high-performance.

ggfan avatar ggfan commented on June 14, 2024

No, not the AAudio API, but the wrapper layer API ( it sits on top of openSL ES and AAudio ), I do not know what will be the final name for it ( I only knew the internal name, it will not help: its final name I did not know ). that lib will be open source project, and be added into this repo when it is ready; it will NOT be inside android framework. Phil's talk today does not have time to get more details on it; but his talk for Android Developer Preview 1 addressed that more.

I tried to have this Android-O requirement in the readme file for THIS sample:
https://github.com/googlesamples/android-audio-high-performance/blob/master/aaudio/README.md
Will add code to check on target android device's API level, if less than 26, will gracefully fail.

from android-audio-high-performance.

IgorGanapolsky avatar IgorGanapolsky commented on June 14, 2024

@philburk Wouldn't it be prudent to invoke dlsym in this sample, and target lower SDKs?

from android-audio-high-performance.

philburk avatar philburk commented on June 14, 2024

The purpose of the sample code is only to demonstrate how AAudio works. AAudio does not run on lower SDKs so the sample wouldn't run.

Auto-switching between AAudio and OpenSL ES is a good thing but beyond the scope of this sample. I worry that if samples do too much then it obscures the essential information.

from android-audio-high-performance.

ggfan avatar ggfan commented on June 14, 2024

I am adding code to check for API level and fail gracefully.

The sample right NOW is not using dlopen/dlsym(), the init code for that is inside third_party directory, that is more of personal -- developers to choose that way or traditional way ( it is more of convenience to my development ). officially we kind of like to make the sample to be somewhat depends on new NDK ( with dlopen / dlsym in the sample, NDK-15 is not necessary, that could be a benefit )

from android-audio-high-performance.

ggfan avatar ggfan commented on June 14, 2024

#49 is merged: it should not load APK if target is NOT android-O.

from android-audio-high-performance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.