[vlc-commits] mmdevice: fix crash when all devices are removed during playback

Thomas Guillem git at videolan.org
Wed Apr 18 10:57:33 CEST 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr 17 18:44:02 2018 +0200| [5e75553d601b2609c348e291b949459c2353e3c2] | committer: Hugo Beauzée-Luyssen

mmdevice: fix crash when all devices are removed during playback

Check the return value of the DeviceRestartLocked() function (returns 0 if
sys->dev is valid).

(cherry picked from commit f80de9d8983892e84d6bc032fef2c787c22aa65a)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

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

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 3a466bb354..844152cf93 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1153,8 +1153,13 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     EnterMTA();
     EnterCriticalSection(&sys->lock);
 
-    if (sys->request_device_restart)
-        DeviceRestartLocked(aout);
+    if (sys->request_device_restart && DeviceRestartLocked(aout) != 0)
+    {
+        LeaveCriticalSection(&sys->lock);
+        LeaveMTA();
+        vlc_object_release(s);
+        return -1;
+    }
 
     for (;;)
     {



More information about the vlc-commits mailing list