[vlc-commits] mmdevice: don't lock read of sys->dev

Thomas Guillem git at videolan.org
Wed Feb 21 08:51:13 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 21 08:08:18 2018 +0100| [bbb905f00ce0196c8c309ec67dd71310a44812a5] | committer: Thomas Guillem

mmdevice: don't lock read of sys->dev

sys->dev can't be changed (unless requested by the current thread) from the MMSession thread here.

(cherry picked from commit 9f671c24e9d7275071b2d6d8be0b756cd134cbe5)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

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

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index fddc9d4eb3..473bc5dea4 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1086,6 +1086,9 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 {
     aout_sys_t *sys = aout->sys;
 
+    if (sys->dev == NULL)
+        return -1;
+
     const bool b_spdif = AOUT_FMT_SPDIF(fmt);
     const bool b_hdmi = AOUT_FMT_HDMI(fmt);
     if (b_spdif || b_hdmi)
@@ -1113,14 +1116,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 
     EnterMTA();
     EnterCriticalSection(&sys->lock);
-
-    if (sys->dev == NULL)
-    {
-        LeaveCriticalSection(&sys->lock);
-        LeaveMTA();
-        return -1;
-    }
-
     for (;;)
     {
         HRESULT hr;



More information about the vlc-commits mailing list