diff --git a/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs b/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs index 17de1a03a..606eeade3 100644 --- a/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs +++ b/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs @@ -4,11 +4,14 @@ using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; +using System.Threading; namespace Ryujinx.Graphics.Nvdec.H264 { unsafe class FFmpegContext : IDisposable { + private static int _isInitialized; + private readonly av_log_set_callback_callback _logFunc; private readonly AVCodec* _codec; private AVPacket* _packet; @@ -32,7 +35,10 @@ namespace Ryujinx.Graphics.Nvdec.H264 static FFmpegContext() { - SetRootPath(); + if (Interlocked.Exchange(ref _isInitialized, 1) == 0) + { + SetRootPath(); + } } private static void SetRootPath()