mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 05:34:16 -04:00
Backport pull request #13532 from jellyfin/release-10.10.z
Fix image encoding concurrency limit Original-merge: 3f539472f3a7c216a6c7d34fb947a144e249f154 Merged-by: crobibero <cody@robibe.ro> Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
parent
17e78c0d40
commit
1ebef57508
@ -122,7 +122,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
_jsonSerializerOptions = new JsonSerializerOptions(JsonDefaults.Options);
|
_jsonSerializerOptions = new JsonSerializerOptions(JsonDefaults.Options);
|
||||||
_jsonSerializerOptions.Converters.Add(new JsonBoolStringConverter());
|
_jsonSerializerOptions.Converters.Add(new JsonBoolStringConverter());
|
||||||
|
|
||||||
var semaphoreCount = 2 * Environment.ProcessorCount;
|
// Although the type is not nullable, this might still be null during unit tests
|
||||||
|
var semaphoreCount = serverConfig.Configuration?.ParallelImageEncodingLimit ?? 0;
|
||||||
|
if (semaphoreCount < 1)
|
||||||
|
{
|
||||||
|
semaphoreCount = Environment.ProcessorCount;
|
||||||
|
}
|
||||||
|
|
||||||
_thumbnailResourcePool = new(semaphoreCount);
|
_thumbnailResourcePool = new(semaphoreCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
|
|||||||
var semaphoreCount = config.Configuration.ParallelImageEncodingLimit;
|
var semaphoreCount = config.Configuration.ParallelImageEncodingLimit;
|
||||||
if (semaphoreCount < 1)
|
if (semaphoreCount < 1)
|
||||||
{
|
{
|
||||||
semaphoreCount = 2 * Environment.ProcessorCount;
|
semaphoreCount = Environment.ProcessorCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
_parallelEncodingLimit = new(semaphoreCount);
|
_parallelEncodingLimit = new(semaphoreCount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user