|
@@ -122,7 +122,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
_jsonSerializerOptions = new JsonSerializerOptions(JsonDefaults.Options);
|
|
|
_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);
|
|
|
}
|
|
|
|