Skip to content

wasapi: detect device changes and handle disconnection gracefully#2538

Open
0x0003 wants to merge 2 commits into
MusicPlayerDaemon:masterfrom
0x0003:win-wasapi
Open

wasapi: detect device changes and handle disconnection gracefully#2538
0x0003 wants to merge 2 commits into
MusicPlayerDaemon:masterfrom
0x0003:win-wasapi

Conversation

@0x0003

@0x0003 0x0003 commented Jul 12, 2026

Copy link
Copy Markdown

Closes #1408
Closes #1880

Changes were made to Control.hxx, Interface.hxx, Thread.cxx, which are technically a bit out of scope as those are generic, but I couldn't figure out how to make it work some other way.
Their behavior essentially stays the same though, so no other platforms should be affected.

0x0003 added 2 commits July 12, 2026 11:06
Catch exceptions from GetVolume()/SetVolume() so that a disconnected
device (AUDCLNT_E_DEVICE_INVALIDATED) degrades gracefully instead of
crashing MPD.

Closes MusicPlayerDaemon#1880
Register an IMMNotificationClient to receive OnDefaultDeviceChanged
callbacks. On change, the output thread wakes and reopens on the new
default device immediately, bypassing the 10-second fail timer via
a new AudioOutput::IsDeviceChange() virtual.

Closes MusicPlayerDaemon#1408
Closes MusicPlayerDaemon#1880
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant