mpv
mpv copied to clipboard
ao/aaudio: implement aaudio backend for android
Are the advantages over ao_audiotrack significant enough that it warrants merging this and having yet another AO to maintain?
well, using JNI is infamously slow and is more resource intensive. Also this is way cleaner compared to the JNI code and should be easier to maintain.
@sfan5 Another reason is the audiotrack doesn't support exclusive mode audio, which bypasses android's resampling improving audio quality.
opensles does support exlusive mode audio, but only supports 2 channes, while AAudio supports multichannels.
switching to push seems to fix the underrun issues, this is ready for review
Hello @jambonmcyeah, I was just wondering, is the aaudio output set on push exclusive mode by default in mpv? Or should I enable it somehow? Thanks in advance!
well right now this PR not merged by the MPV developers yet. So if you want to use it you have to compile it yourself
and it's now push only, since there were a lot of underruns with pull which I don't know how to fix
and it's now push only, since there were a lot of underruns with pull which I don't know how to fix
Thanks for the response and involvement. My bad, I thought it was already implemented, that's weird, since I don't know what audio driver output my Android device is using right now, especially since I can't get any logs. Anyway, I'll wait for it to be included then, considering my knowledge in programming is rather limited, though.
well right now this PR not merged by the MPV developers yet. So if you want to use it you have to compile it yourself
Hello again,
I actually ended up trying to compile it myself, using Android Studio, but I don't know where to add the ao_aaudio.c file inside the source code of the Android port of mpv. Could you please help me somehow/give some informations? Thanks in advance, that would be greatly appreciated: https://github.com/mpv-android/mpv-android/tree/master
I tried Building it from the mpv-android buildscripts but it had missing libraries here is my partial log https://0x0.st/H536.txt
mpv-android builds with API 21, AAudio was introduced with API 26. I don't have plans to raise the API currently, especially not for a new audio driver when audio already works perfectly fine.
If you want to test you can edit the API level in buildscripts/buildall.sh
and app/build.gradle
.
So addition of this AO should be behind meson option and auto-detected.
mpv-android builds with API 21, AAudio was introduced with API 26. I don't have plans to raise the API currently, especially not for a new audio driver when audio already works perfectly fine.
Consider adding an option to toggle, and this option only appears on API26+ devices
Consider adding an option to toggle, and this option only appears on API26+ devices
UI isn't the main problem. If I build the native code with api level 26 it will not work on 25 and lower. A possible workaround on the mpv side is to load methods dynamically: https://github.com/mpv-player/mpv/blob/ab3a63285a44e6b41e171e737950d8d266ca79db/video/out/hwdec/hwdec_aimagereader.c#L108