Browse Source

fix nvidia troubleshooting on arm64 (#2508)

pull/2509/head
Jason Dove 3 months ago committed by GitHub
parent
commit
07ffa1642b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      ErsatzTV.FFmpeg/Capabilities/Nvidia/CudaHelper.cs
  2. 10
      ErsatzTV.FFmpeg/Capabilities/Nvidia/NvEncSharpRedirector.cs

4
ErsatzTV.FFmpeg/Capabilities/Nvidia/CudaHelper.cs

@ -8,6 +8,8 @@ namespace ErsatzTV.FFmpeg.Capabilities.Nvidia; @@ -8,6 +8,8 @@ namespace ErsatzTV.FFmpeg.Capabilities.Nvidia;
internal static class CudaHelper
{
public static bool IsLoaded { get; set; }
private static bool _success;
private static bool _initialized;
private static readonly Lock Lock = new();
@ -82,7 +84,7 @@ internal static class CudaHelper @@ -82,7 +84,7 @@ internal static class CudaHelper
{
var result = new List<CudaDevice>();
if (!EnsureInit())
if (!IsLoaded || !EnsureInit())
{
return Option<List<CudaDevice>>.None;
}

10
ErsatzTV.FFmpeg/Capabilities/Nvidia/NvEncSharpRedirector.cs

@ -7,7 +7,15 @@ public static class NvEncSharpRedirector @@ -7,7 +7,15 @@ public static class NvEncSharpRedirector
{
static NvEncSharpRedirector()
{
NativeLibrary.SetDllImportResolver(typeof(Lennox.NvEncSharp.LibCuda).Assembly, Resolver);
try
{
NativeLibrary.SetDllImportResolver(typeof(Lennox.NvEncSharp.LibCuda).Assembly, Resolver);
CudaHelper.IsLoaded = true;
}
catch (FileNotFoundException)
{
CudaHelper.IsLoaded = false;
}
}
private static IntPtr Resolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)

Loading…
Cancel
Save