-
Notifications
You must be signed in to change notification settings - Fork 147
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
Deadlock on Mix_PlayChannel #524
Comments
What are the callstacks of the other threads in the application? In particular, it would be helpful to know what else already has the audio mutex locked. |
Thanks for the reply. This is the only application interaction with the SDL API. The lock appears to be held by the internal SDL audio processing thread. I'll share that call stack later today. |
@ebarlas If it's aaudio, maybe this is a duplicate of libsdl-org/SDL#4985 ? |
@ebarlas, |
I just confirmed that the AAudio driver is being used currently, @1bsyl. I'll try toggling. |
When I switch to All of the Android defaults have worked well across SDL libraries, so I haven't toggled them. However, do you recommend that I disable the AAudio driver? |
That seems odd that the DRMP3 mixing process isn't releasing the lock. Can you verify that it actually completes in this case? Maybe the lock is taken somewhere else and then not released properly? |
I had the same thought. Indeterminate audio processing would be strange. I'll try to annotate the code to gather more timing info. But from everything I've gathered so far, that application thread is completely stalled there waiting to obtain the lock from the audio processing thread. |
I don't exactly remember why, because of previous issue, I use this patch for aaudio:
but I am not sure if this is related. is your main event loop blocked ? audio is blocked ? do you have only the SDL main or various threads ? |
I'm using the latest SDL 2 release: 2.6.3. Yes, main loop is blocked as shown on SDL mixer API call. I haven't instrumented the code yet, so it's hard to make specific claims about timing on the main and audio threads. I'll add that shortly and report back. |
I reproduced the issue with a bit of extra logging in I added the following snippets at the beginning and end of
and the following at the beginning and end of
The results are striking. The Android alarm fired at about SDL-ticks 34000. Calls to So the audio processing workload is literally starving the application thread of access.
|
mix_channels() is callback of SDL_OpenAudioDevice, set from SDL_mixer/src/mixer.c It's called from SDL/src/audio/SDL_audio.c ( line ~592), so this seems to loop to much. In normal case, the delay should come from end to the function, 3rd if-block. (unless you need to convert sample, that would use the 1 if-block).
WaitDevice, has no implementation (but also for other backend), I haven't been able to reproduce the issue, by using a timer alarm. this still loops normally. |
Today I encountered a strange SDL Mixer issue on my Pixel 6 Pro Android device.
If an alarm notification occurs while my SDL indie game app is running, the SDL Mixer system gets irreparably harmed.
Post-notification, calls to the SDL Mixer system stall waiting to obtain a mutex lock.
I tried rearranging interactions with SDL Mixer in a few ways, but nothing works. It seems be out of my hands as the app developer.
The text was updated successfully, but these errors were encountered: