From 134e74414d2644f1c345a2ef8876504aaaa69027 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 29 Sep 2017 02:13:05 -0400 Subject: update translations --- .../MediaEncoding/EncodingHelper.cs | 36 ++++++---------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs') diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index ee7b9f080..861f4467d 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1531,11 +1531,18 @@ namespace MediaBrowser.Controller.MediaEncoding /// System.Int32. public int GetNumberOfThreads(EncodingJobInfo state, EncodingOptions encodingOptions, bool isWebm) { - var threads = GetNumberOfThreadsInternal(state, encodingOptions, isWebm); + if (isWebm) + { + // Recommended per docs + return Math.Max(Environment.ProcessorCount - 1, 2); + } + + var threads = state.BaseRequest.CpuCoreLimit ?? encodingOptions.EncodingThreadCount; - if (state.BaseRequest.CpuCoreLimit.HasValue && state.BaseRequest.CpuCoreLimit.Value > 0) + // Automatic + if (threads <= 0 || threads >= Environment.ProcessorCount) { - threads = Math.Min(threads, state.BaseRequest.CpuCoreLimit.Value); + return 0; } return threads; @@ -1957,29 +1964,6 @@ namespace MediaBrowser.Controller.MediaEncoding return null; } - /// - /// Gets the number of threads. - /// - /// System.Int32. - private int GetNumberOfThreadsInternal(EncodingJobInfo state, EncodingOptions encodingOptions, bool isWebm) - { - var threads = encodingOptions.EncodingThreadCount; - - if (isWebm) - { - // Recommended per docs - return Math.Max(Environment.ProcessorCount - 1, 2); - } - - // Automatic - if (threads == -1) - { - return 0; - } - - return threads; - } - public string GetSubtitleEmbedArguments(EncodingJobInfo state) { if (state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed) -- cgit v1.2.3