소스 검색

Make priority class setting more robust (#15177)

gnattu 1 개월 전
부모
커밋
70c32a26fa
2개의 변경된 파일18개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 1
      MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
  2. 9 1
      src/Jellyfin.MediaEncoding.Keyframes/FfProbe/FfProbeKeyframeExtractor.cs

+ 9 - 1
MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs

@@ -1122,7 +1122,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
         private void StartProcess(ProcessWrapper process)
         {
             process.Process.Start();
-            process.Process.PriorityClass = ProcessPriorityClass.BelowNormal;
+
+            try
+            {
+                process.Process.PriorityClass = ProcessPriorityClass.BelowNormal;
+            }
+            catch (Exception ex)
+            {
+                _logger.LogWarning(ex, "Unable to set process priority to BelowNormal for {ProcessFileName}", process.Process.StartInfo.FileName);
+            }
 
             lock (_runningProcessesLock)
             {

+ 9 - 1
src/Jellyfin.MediaEncoding.Keyframes/FfProbe/FfProbeKeyframeExtractor.cs

@@ -42,7 +42,15 @@ public static class FfProbeKeyframeExtractor
         try
         {
             process.Start();
-            process.PriorityClass = ProcessPriorityClass.BelowNormal;
+            try
+            {
+                process.PriorityClass = ProcessPriorityClass.BelowNormal;
+            }
+            catch
+            {
+                // We do not care if process priority setting fails
+                // Ideally log a warning but this does not have a logger available
+            }
 
             return ParseStream(process.StandardOutput);
         }