|
|
|
@ -2329,15 +2329,17 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the number of threads.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static int GetNumberOfThreads(EncodingJobInfo state, EncodingOptions encodingOptions, string outputVideoCodec)
|
|
|
|
|
#nullable enable
|
|
|
|
|
public static int GetNumberOfThreads(EncodingJobInfo? state, EncodingOptions encodingOptions, string? outputVideoCodec)
|
|
|
|
|
{
|
|
|
|
|
if (outputVideoCodec != null && string.Equals(outputVideoCodec, "libvpx", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (string.Equals(outputVideoCodec, "libvpx", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
// per docs:
|
|
|
|
|
// -threads number of threads to use for encoding, can't be 0 [auto] with VP8
|
|
|
|
|
// (recommended value : number of real cores - 1)
|
|
|
|
|
return Math.Max(Environment.ProcessorCount - 1, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var threads = state?.BaseRequest.CpuCoreLimit ?? encodingOptions.EncodingThreadCount;
|
|
|
|
|
|
|
|
|
|
// Automatic
|
|
|
|
@ -2352,7 +2354,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
|
|
|
|
|
|
|
return threads;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
public void TryStreamCopy(EncodingJobInfo state)
|
|
|
|
|
{
|
|
|
|
|
if (state.VideoStream != null && CanStreamCopyVideo(state, state.VideoStream))
|
|
|
|
|