Backport pull request #15177 from jellyfin/release-10.11.z

Make priority class setting more robust

Original-merge: 70c32a26fa

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
gnattu
2025-10-27 15:43:22 -04:00
committed by Bond_009
parent 6514196e8d
commit 511b5d9c53
2 changed files with 18 additions and 2 deletions

View File

@@ -1122,7 +1122,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
private void StartProcess(ProcessWrapper process) private void StartProcess(ProcessWrapper process)
{ {
process.Process.Start(); 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) lock (_runningProcessesLock)
{ {

View File

@@ -42,7 +42,15 @@ public static class FfProbeKeyframeExtractor
try try
{ {
process.Start(); 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); return ParseStream(process.StandardOutput);
} }