[vlc-commits] mmdevice: fix assert/UB when changing volume without any devices

Thomas Guillem git at videolan.org
Tue Nov 14 14:36:40 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Nov 14 14:32:58 2017 +0100| [fd09bcfd9b8b32fbe0fb98d2899068229fda17e2] | committer: Thomas Guillem

mmdevice: fix assert/UB when changing volume without any devices

If there is no audio devices, Open() will succeed but MMSession() will fail.
Then, MMThread() will wait for any events in order to call MMSession() again.
In that case, don't try to call MMsession() without a valid device when volume
or mute is changed from the user.

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

 modules/audio_output/mmdevice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 4f32cf0ea8..b6d116622e 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1037,7 +1037,7 @@ static void *MMThread(void *data)
     EnterCriticalSection(&sys->lock);
 
     do
-        if (FAILED(MMSession(aout, it)))
+        if (sys->requested_device == NULL || FAILED(MMSession(aout, it)))
             SleepConditionVariableCS(&sys->work, &sys->lock, INFINITE);
     while (sys->it != NULL);
 



More information about the vlc-commits mailing list