-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ma_device_uninit crash on Android <= 10 #833
Comments
Sorry for the delay on this one. Unfortunately I was unable to replicate this. I tried using the "Pixel 2 XL API 27" emulator and it works fine here. However, I've pushed a potential fix to the dev branch. Are you able to give that a try without your |
I also tried the "Pixel 2 XL API 27" emulator without any problems! I tried with your updated dev branch and also by patching log
Seems like an AAudio bug on API 10 that doesn't want to close itself if it never got frames delivered or it does not have the time to instantiate the virtual Here an updated brief devices summary:
|
Exact same issue for me on Android 10, I decided to define MA_NO_AAUDIO and this works fine. |
I bypassed SoLoud and used almost your
This is the log happening at a random `n`:V/TEST NDK( 7382): Loop 21. I/AAudio ( 7382): AAudioStreamBuilder_openStream() called ---------------------------------------- I/AudioStreamBuilder( 7382): rate = 44100, channels = 2, format = 5, sharing = SH, dir = OUTPUT I/AudioStreamBuilder( 7382): device = 0, sessionId = -1, perfMode = 12, callback: ON with frames = 441 I/AudioStreamBuilder( 7382): usage = 0, contentType = 0, inputPreset = 0, allowedCapturePolicy = 0 D/ ( 7382): PlayerBase::PlayerBase() D/AudioStreamTrack( 7382): open(), request notificationFrames = 441, frameCount = 1323 I/AudioTrack( 7382): createTrack_l(499): AUDIO_OUTPUT_FLAG_FAST successful; frameCount 1323 -> 1323 W/AudioStreamTrack( 7382): open() flags changed from 0x00000104 to 0x00000004 I/AAudio ( 7382): AAudioStreamBuilder_openStream() returns 0 = AAUDIO_OK for s#122 ---------------- V/TEST NDK( 7382): Playback device opened. D/AAudio ( 7382): AAudioStream_requestStart(s#122) called -------------- D/ ( 7382): PlayerBase::start() from IPlayer D/AAudio ( 7382): AAudioStream_requestStart(s#122) returned 0 --------- D/AudioStreamLegacy( 7382): onAudioDeviceUpdate() devId 2 => 2 V/TEST NDK( 7382): Playback device started. D/AAudio ( 7382): AAudioStream_close(s#122) called --------------- F/libc ( 7382): /home/deimos/FLUTTER/libs/flutter_soloud/src/soloud/src/backend/miniaudio/miniaudio.h:19207: void ma_device__read_frames_from_client(ma_device *, ma_uint32, void *): assertion "frameCount > 0" failed F/libc ( 7382): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7673 (AudioTrack), pid 7382 (.soloud.example) *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'google/sdk_gphone_x86/generic_x86:10/QSR1.210802.001/7603624:userdebug/dev-keys' Revision: '0' ABI: 'x86' Timestamp: 2024-08-06 23:08:44+0200 pid: 7382, tid: 7673, name: AudioTrack >>> flutter.soloud.example <<< uid: 10151 signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- Abort message: '/home/deimos/FLUTTER/libs/flutter_soloud/src/soloud/src/backend/miniaudio/miniaudio.h:19207: void ma_device__read_frames_from_client(ma_device *, ma_uint32, void *): assertion "frameCount > 0" failed' eax 00000000 ebx 00001cd6 ecx 00001df9 edx 00000006 edi e994a33e esi aca7dbb0 ebp eaa62ef0 esp aca7db58 eip eaa62ef9 backtrace: #00 pc 00000ef9 [vdso] (__kernel_vsyscall+9) #1 pc 00092328 /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: 471745f0fbbcedb3db1553d5bd6fcd8b) #2 pc 000ad651 /apex/com.android.runtime/lib/bionic/libc.so (abort+193) (BuildId: 471745f0fbbcedb3db1553d5bd6fcd8b) #3 pc 000adb88 /apex/com.android.runtime/lib/bionic/libc.so (__assert2+56) (BuildId: 471745f0fbbcedb3db1553d5bd6fcd8b) #4 pc 0012eef0 /data/app/flutter.soloud.example-PLamRCiAL-81IMTFeuU2Dg==/lib/x86/libflutter_soloud_plugin.so (BuildId: 1b14ff7ccf70ed8f24f717fdf8387428bfe61f0a) #5 pc 0012e091 /data/app/flutter.soloud.example-PLamRCiAL-81IMTFeuU2Dg==/lib/x86/libflutter_soloud_plugin.so (BuildId: 1b14ff7ccf70ed8f24f717fdf8387428bfe61f0a) #6 pc 00185ed3 /data/app/flutter.soloud.example-PLamRCiAL-81IMTFeuU2Dg==/lib/x86/libflutter_soloud_plugin.so (BuildId: 1b14ff7ccf70ed8f24f717fdf8387428bfe61f0a) #7 pc 0001a035 /system/lib/libaaudio.so (aaudio::AudioStream::maybeCallDataCallback(void*, int)+69) (BuildId: 763922c0b912534fb5c7a27226c6187a) #8 pc 0001c2f6 /system/lib/libaaudio.so (aaudio::AudioStreamLegacy::onProcessFixedBlock(unsigned char*, int)+182) (BuildId: 763922c0b912534fb5c7a27226c6187a) #9 pc 0001c36c /system/lib/libaaudio.so (non-virtual thunk to aaudio::AudioStreamLegacy::onProcessFixedBlock(unsigned char*, int)+44) (BuildId: 763922c0b912534fb5c7a27226c6187a) #10 pc 0001f770 /system/lib/libaaudio.so (FixedBlockReader::processVariableBlock(unsigned char*, int)+192) (BuildId: 763922c0b912534fb5c7a27226c6187a) #11 pc 0001c5af /system/lib/libaaudio.so (aaudio::AudioStreamLegacy::processCallbackCommon(int, void*)+559) (BuildId: 763922c0b912534fb5c7a27226c6187a) #12 pc 0001e55b /system/lib/libaaudio.so (aaudio::AudioStreamTrack::processCallback(int, void*)+59) (BuildId: 763922c0b912534fb5c7a27226c6187a) #13 pc 0001c177 /system/lib/libaaudio.so (AudioStreamLegacy_callback(int, void*, void*)+39) (BuildId: 763922c0b912534fb5c7a27226c6187a) #14 pc 0005bc46 /system/lib/libaudioclient.so (android::AudioTrack::processAudioBuffer()+2742) (BuildId: 4a182c5ae196b1b3c87306222ba09430) #15 pc 0005e448 /system/lib/libaudioclient.so (android::AudioTrack::AudioTrackThread::threadLoop()+184) (BuildId: 4a182c5ae196b1b3c87306222ba09430) #16 pc 000140fe /system/lib/libutils.so (android::Thread::_threadLoop(void*)+238) (BuildId: 288ba3aff5b46dbd7e74be954af88b83) #17 pc 000b660b /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+171) (BuildId: 3643bee2c4fb7899d7781c565843060b) #18 pc 00013aa6 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+246) (BuildId: 288ba3aff5b46dbd7e74be954af88b83) #19 pc 0011a8e5 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+53) (BuildId: 471745f0fbbcedb3db1553d5bd6fcd8b) #20 pc 000af6a7 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71) (BuildId: 471745f0fbbcedb3db1553d5bd6fcd8b) Lost connection to device. Exited. IMHO I think that this is not a miniaudio problem, but AAudio issue on Android SDK < 30. Thank you very much for all your support and feel free to close this issue. |
Hi, thanks for your amazing work!
I am developing a plugin with Flutter and I got crashes on Android devices and emulators with SDK <= 29.
Description:
I am using SoLoud c++ lib with miniaudio as the default audio backend.
On Android devices and emulators with SDK <= 29 (but not on Samsung Galaxy S9+ with Android 10 API 29), I get a crash when uninit the player. The relevant SoLoud source is here.
Seems related to AAudio and some buffers not freed, something similar to #466.
The crash occurs randomly when init-unint in a loop.
I tried also with the
dev
branch without luck.FYI here is the plugin issue.
My workaround is to disable AAudio for SDK <= 29:
Hope I have given you all the info.
Thanks in advance for your time.
Here the error log with `MA_DEBUG_OUTPUT` and `MINIAUDIO_IMPLEMENTATION` defined
The text was updated successfully, but these errors were encountered: