-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Android openSLES mal_device_uninit deadlock #41
Comments
What thread are you calling mal_device_uninit() from? What version of Android? Hardware or emulator? EDIT: Is it happening consistently, or randomly? |
both the last version of master and dev, Android 7.0 , Hardware , Xiaomi redmi , consistently. the log pthread 0x7f6a27a450 is the caller thread, a object locked by self ? or the mutexlock need a PTHREAD_MUTEX_RECURSIVE lock ? i found a android issue there: https://groups.google.com/forum/#!searchin/android-ndk/deadlock/android-ndk/G7dLKAGGL28/xwlmjpdv2ssJ |
I'm not sure what's going on. This is the first report I've had with this. I'm wondering if it's something to do with the callback being running at the same time as Destroy() is called. Not 100% sure, though... Are you calling mal_device_uninit() from the same thread as the call to mal_device_init()? Also, make sure you're not calling it from the callback thread. |
Is it happening on any other devices or emulators? |
i have found lots of this issue of opensl, it's not mini_al issue , i create and destroy the device by same thread , and not call it from callback . |
Test in Xiaomi mi6 / Android 8.0, same as Xiaomi redmi note4x, deadlok. seems ,it's not the random occue event and in less class of device , is there a solution to avoid openSLES issue? |
OpenSL|ES is the only supported backend for Android. An AAudio backend is planned, but this is only supported on later versions of Android. This feels like a bug in mini_al somewhere. I will need to do a few experiments and get back to you. |
and i test in android emulator 7.0 (X86_64 without google api) ,it would deadlock too. |
OK something I just saw in your screenshot is that the variable Some basic things to consider:
Meanwhile, I have pushed an update to the dev branch which checks for this and throws an assert. Can you please let me know what the outcome of that is? |
Yes, it's my fault, i init mal_context before init mal_device , should be uninit mal_context after uninit mal_device , but before that , thank you point out the error .i changed that it's work. :) :) :) |
That's good to hear! So everything is working now? |
all ok, please close the thread. |
Great! Closing. |
init a playback mal_device , then playback audio success
but uninit the device encounter a deadlock:
deadlock at line.18250
if (pDevice->opensl.pAudioPlayerObj) MAL_OPENSL_OBJ(pDevice->opensl.pAudioPlayerObj)->Destroy((SLObjectItf)pDevice->opensl.pAudioPlayerObj);
12-15 02:09:27.078 30702-31005/org.minijvm.activity I/libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
12-15 02:09:27.084 30702-31005/org.minijvm.activity W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 22050 Hz, output 48000 Hz
12-15 02:09:27.087 30702-31005/org.minijvm.activity D/AudioTrack: Client defaulted notificationFrames to 296 for frameCount 890
12-15 02:09:43.381 30702-31005/org.minijvm.activity E/libOpenSLES: Object::Destroy(0x7f68ba9000) for engine ignored; 2 total active objects
12-15 02:09:43.381 30702-31005/org.minijvm.activity E/libOpenSLES: Object::Destroy(0x7f68ba9000) for engine ignored; active object ID 2 at 0x7f68dd1000
12-15 02:09:43.381 30702-31005/org.minijvm.activity E/libOpenSLES: Object::Destroy(0x7f68ba9000) for engine ignored; active object ID 3 at 0x7f68a89c00
12-15 02:13:09.824 30702-31005/org.minijvm.activity E/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread_mutex_lock_timeout_np returned 110
12-15 02:13:09.845 30702-31005/org.minijvm.activity E/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread_mutex_lock_timeout_np returned 110
12-15 02:13:09.875 30702-31005/org.minijvm.activity E/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread_mutex_lock_timeout_np returned 110
12-15 02:13:09.915 30702-31005/org.minijvm.activity E/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread_mutex_lock_timeout_np returned 110
12-15 02:13:09.966 30702-31005/org.minijvm.activity E/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread_mutex_lock_timeout_np returned 110
12-15 02:13:10.067 30702-31005/org.minijvm.activity E/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread_mutex_lock_timeout_np returned 110
12-15 02:13:10.067 30702-31005/org.minijvm.activity W/libOpenSLES: frameworks/wilhelm/src/itf/IObject.c:556: pthread 0x7f6a27a450 (tid 31005) sees object 0x7f68ba9000 was locked by pthread 0x7f6a27a450 (tid 31005) at frameworks/wilhelm/src/itf/IObject.c:411
The text was updated successfully, but these errors were encountered: