We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3602

Summary: XAudio2 driver hangs thread after audio device is disabled/disconnected
Product: SDL Reporter: Damir Veapi <damir.veapi>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.5   
Hardware: x86   
OS: Windows 8   
Attachments: sample for reproduction

Description Damir Veapi 2017-03-10 02:08:40 UTC
Created attachment 2704 [details]
sample for reproduction

XAudio2 doesn't handle device disconnect well. It looks like it hangs the thread and prevents the application from exiting.

Steps to reproduce:

1. Play audio with SDL.
2. Disconnect your speakers/headphones, or disable them in the "Playback devices" panel.
4. Re-enable or reconnect the speakers.
3. Quit the SDL app.

Expected result:

The sound should resume playing when the audio device is reconnected. App should close neatly without leaving a lingering process.

What happens:

There is no sound after reconnecting the audio device (step 4), nor does it switch to another device when available. When the app quits, it seemingly closes, but a lingering process remains.

Workaround:

Use 'directmedia' audio driver on Windows.

I am attaching an example SDL app, which you can use to reproduce and test the issue.
Comment 1 Damir Veapi 2017-03-10 02:10:51 UTC
Forgot to add: this might be related to bug 2940.
Comment 2 Ryan C. Gordon 2017-05-18 19:31:05 UTC
This should be fixed in revision control.

--ryan.
Comment 3 Ryan C. Gordon 2017-05-27 20:07:07 UTC
Going to resolve this bug for now, since this is believed to be fixed, and XAudio2 is going away anyhow.

--ryan.