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 - XAudio2 driver hangs thread after audio device is disabled/disconnected
Summary: XAudio2 driver hangs thread after audio device is disabled/disconnected
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.5
Hardware: x86 Windows 8
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-10 02:08 UTC by Damir Veapi
Modified: 2017-05-27 20:07 UTC (History)
0 users

See Also:


Attachments
sample for reproduction (3.68 MB, application/zip)
2017-03-10 02:08 UTC, Damir Veapi
Details

Note You need to log in before you can comment on or make changes to this bug.
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.