Fix AssertionError crash when audio source finishes while paused#2633
Fix AssertionError crash when audio source finishes while paused#2633riccardobl merged 2 commits intomasterfrom
Conversation
Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
|
@copilot detect if this patch can cause side effects in the codebase and write a detailed report |
Here is the detailed side-effects analysis for the one-line change ( Side-Effects AnalysisWhat the change doesThe condition that gates the "source has stopped, decide whether to reclaim the channel" block was widened from only matching The existing channel-reclaim logic inside the block is unchanged. Case 1 — Non-looping buffer source (most common, the primary bug scenario)State: A short clip finishes playing in the same frame it is paused. OpenAL reports
No side effects. The source ends up in Case 2 — Looping buffer sourceState: OpenAL should never stop a looping buffer on its own, so this combination requires an external disturbance (device reset, driver bug).
The warning (already present for the Case 3 — Streaming source, EOF reached, not loopingState:
Case 4 — Streaming source, buffer starvation while "paused"State: This scenario is theoretically reachable if starvation occurs and a pause command lands before
|
A race condition in
ALAudioRenderer.updateInRenderThread()causes anAssertionErrorwhen an audio clip finishes playing in the same frame it is paused — OpenAL reportsAL_STOPPEDwhile JME still holdsStatus.Paused, hitting the unhandled mismatch branch. Fixes #2550Change
Widen the reclaim condition from
jmeStatus == Status.PlayingtojmeStatus != Status.Stopped, giving OpenAL'sAL_STOPPEDstate final authority over channel reclamation regardless of whether JME considered the source playing or paused:The existing channel-reclaim logic (stream EOF detection, looping-buffer warning, buffer finished path) is correct for both
PlayingandPausedJME states — only the guard condition was too narrow.Original prompt
This section details on the original issue you should resolve
<issue_title>Crash when pausing audio</issue_title>
<issue_description>Code in question from ALAudioRenderer.java: