Commit 5eaa1cf9 authored by Thomas Guillem's avatar Thomas Guillem

mmdevice: fix crash when unplugging a device

Restarting the audio output is not enough when a device is unplugged. Indeed,
the Start function will use the old (and invalid) device.
To fix this issue, re-select the default device in case of error.
parent bca53c8f
......@@ -114,11 +114,12 @@ struct aout_sys_t
* synchronization between the set of audio output callbacks, MMThread()
* and (trivially) the device and session notifications. */
static int DeviceSelect(audio_output_t *, const char *);
static int vlc_FromHR(audio_output_t *aout, HRESULT hr)
{
/* Restart on unplug */
/* Select the default device (and restart) on unplug */
if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED))
aout_RestartRequest(aout, AOUT_RESTART_OUTPUT);
DeviceSelect(aout, NULL);
return SUCCEEDED(hr) ? 0 : -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment