lazy initialization

This commit is contained in:
Ac_K 2021-05-20 01:42:21 +02:00
parent 83d6e4118b
commit f675d26a5d

View File

@ -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()