diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-04-29 13:39:23 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-04-29 13:39:23 -0400 |
| commit | a75ce4197d89e90f97155fef81bbb65f954ae6a4 (patch) | |
| tree | 9f7cfc6ba232509f6b6a58890f8add598dca71ab /MediaBrowser.Server.Startup.Common/ApplicationHost.cs | |
| parent | 88191e01dad8e47af23c7478cf49f2632fd9f52c (diff) | |
3.0.5597.1
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/ApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 1a20f7431..050b7aabe 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -439,7 +439,7 @@ namespace MediaBrowser.Server.Startup.Common var innerProgress = new ActionableProgress<double>(); innerProgress.RegisterAction(p => progress.Report((.75 * p) + 15)); - ImageProcessor = new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder()); + ImageProcessor = GetImageProcessor(); RegisterSingleInstance(ImageProcessor); TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager); @@ -543,6 +543,18 @@ namespace MediaBrowser.Server.Startup.Common await ((UserManager)UserManager).Initialize().ConfigureAwait(false); } + private IImageProcessor GetImageProcessor() + { + var maxConcurrentImageProcesses = Math.Max(Environment.ProcessorCount, 4); + + if (_startupOptions.ContainsOption("-imagethreads")) + { + int.TryParse(_startupOptions.GetOption("-imagethreads"), NumberStyles.Any, CultureInfo.InvariantCulture, out maxConcurrentImageProcesses); + } + + return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder(), maxConcurrentImageProcesses); + } + private IImageEncoder GetImageEncoder() { if (!_startupOptions.ContainsOption("-enablegdi")) |
