[vlc-commits] audio_output/winstore: do the MTA+lock before setting the initial device

Steve Lhomme git at videolan.org
Wed Nov 25 07:37:24 CET 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Nov 24 09:15:27 2020 +0100| [7a9e4b5539251cbd3ea4823206e1412db24dae79] | committer: Steve Lhomme

audio_output/winstore: do the MTA+lock before setting the initial device

The requested device is set to the default one in Open and requires the MTA
setup in order for the activation to work. Otherwise it deadlocks.

(cherry picked from commit 5f17d0a79d7bb3feedced46159b8186891cc1a50) (rebased)

rebased:
- this branch uses vlc_object_release() instead of vlc_object_delete()

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

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

 modules/audio_output/winstore.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/audio_output/winstore.c b/modules/audio_output/winstore.c
index 211ed5001f..b542408306 100644
--- a/modules/audio_output/winstore.c
+++ b/modules/audio_output/winstore.c
@@ -437,6 +437,10 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     if (unlikely(s == NULL))
         return -1;
 
+    // Load the "out stream" for the requested device
+    EnterMTA();
+    EnterCriticalSection(&sys->lock);
+
     if (sys->requested_device != NULL)
     {
         if (sys->acquired_device == NULL || wcscmp(sys->acquired_device, sys->requested_device))
@@ -445,16 +449,14 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
             DeviceRestartLocked(aout);
             if (sys->client == NULL)
             {
+                LeaveCriticalSection(&sys->lock);
+                LeaveMTA();
                 vlc_object_release(s);
                 return -1;
             }
         }
     }
 
-    // Load the "out stream" for the requested device
-    EnterMTA();
-    EnterCriticalSection(&sys->lock);
-
     s->owner.activate = ActivateDevice;
     for (;;)
     {



More information about the vlc-commits mailing list