From d69f62d2ce9bd7580e681c980e4e0bf2afe819df Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Mon, 6 Mar 2023 16:43:31 -0800 Subject: [PATCH] fix video loader race condition --- src/Video/VideoPlayer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Video/VideoPlayer.cs b/src/Video/VideoPlayer.cs index 59f3c3d..c5da121 100644 --- a/src/Video/VideoPlayer.cs +++ b/src/Video/VideoPlayer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Runtime.InteropServices; using MoonWorks.Audio; @@ -124,7 +124,10 @@ namespace MoonWorks.Video Video = video; - InitializeTheoraStream(); + lock (AudioDevice.StateLock) + { + InitializeTheoraStream(); + } } }