[vlc-commits] audio_output/winstore: do the MTA+lock before setting the initial device
Steve Lhomme
git at videolan.org
Wed Nov 25 07:20:27 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Nov 24 09:15:27 2020 +0100| [5f17d0a79d7bb3feedced46159b8186891cc1a50] | 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f17d0a79d7bb3feedced46159b8186891cc1a50
---
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 07c4422f41..94c2d89066 100644
--- a/modules/audio_output/winstore.c
+++ b/modules/audio_output/winstore.c
@@ -431,6 +431,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))
@@ -439,16 +443,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_delete(&s->obj);
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