[vlc-commits] mmdevice: fix crash when unplugging a device

Thomas Guillem git at videolan.org
Wed May 25 14:35:07 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May 19 14:28:19 2016 +0200| [5eaa1cf9ef3eb6a312fa2f0f8056866ac8277e10] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5eaa1cf9ef3eb6a312fa2f0f8056866ac8277e10
---

 modules/audio_output/mmdevice.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index aa657d3..193c52a 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -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;
 }
 



More information about the vlc-commits mailing list