mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Review suggestions
This commit is contained in:
parent
38c3b6fcd3
commit
2deda0437d
@ -1329,7 +1329,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
{
|
{
|
||||||
var videoCodec = _encodingHelper.GetVideoEncoder(state, encodingOptions);
|
var videoCodec = _encodingHelper.GetVideoEncoder(state, encodingOptions);
|
||||||
|
|
||||||
var threads = EncodingHelper.GetNumberOfThreads(state, encodingOptions, videoCodec); // GetNumberOfThreads is static
|
var threads = EncodingHelper.GetNumberOfThreads(state, encodingOptions, videoCodec); // GetNumberOfThreads is static.
|
||||||
|
|
||||||
if (state.BaseRequest.BreakOnNonKeyFrames)
|
if (state.BaseRequest.BreakOnNonKeyFrames)
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
private string GetCommandLineArguments(string outputPath, StreamState state)
|
private string GetCommandLineArguments(string outputPath, StreamState state)
|
||||||
{
|
{
|
||||||
var videoCodec = _encodingHelper.GetVideoEncoder(state, _encodingOptions);
|
var videoCodec = _encodingHelper.GetVideoEncoder(state, _encodingOptions);
|
||||||
var threads = EncodingHelper.GetNumberOfThreads(state, _encodingOptions, videoCodec); // GetNumberOfThreads is static
|
var threads = EncodingHelper.GetNumberOfThreads(state, _encodingOptions, videoCodec); // GetNumberOfThreads is static.
|
||||||
var inputModifier = _encodingHelper.GetInputModifier(state, _encodingOptions);
|
var inputModifier = _encodingHelper.GetInputModifier(state, _encodingOptions);
|
||||||
var format = !string.IsNullOrWhiteSpace(state.Request.SegmentContainer) ? "." + state.Request.SegmentContainer : ".ts";
|
var format = !string.IsNullOrWhiteSpace(state.Request.SegmentContainer) ? "." + state.Request.SegmentContainer : ".ts";
|
||||||
var directory = Path.GetDirectoryName(outputPath) ?? throw new ArgumentException($"Provided path ({outputPath}) is not valid.", nameof(outputPath));
|
var directory = Path.GetDirectoryName(outputPath) ?? throw new ArgumentException($"Provided path ({outputPath}) is not valid.", nameof(outputPath));
|
||||||
|
@ -2329,15 +2329,17 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the number of threads.
|
/// Gets the number of threads.
|
||||||
/// </summary>
|
/// </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:
|
// per docs:
|
||||||
// -threads number of threads to use for encoding, can't be 0 [auto] with VP8
|
// -threads number of threads to use for encoding, can't be 0 [auto] with VP8
|
||||||
// (recommended value : number of real cores - 1)
|
// (recommended value : number of real cores - 1)
|
||||||
return Math.Max(Environment.ProcessorCount - 1, 1);
|
return Math.Max(Environment.ProcessorCount - 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var threads = state?.BaseRequest.CpuCoreLimit ?? encodingOptions.EncodingThreadCount;
|
var threads = state?.BaseRequest.CpuCoreLimit ?? encodingOptions.EncodingThreadCount;
|
||||||
|
|
||||||
// Automatic
|
// Automatic
|
||||||
@ -2352,7 +2354,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
|
|
||||||
return threads;
|
return threads;
|
||||||
}
|
}
|
||||||
|
#nullable disable
|
||||||
public void TryStreamCopy(EncodingJobInfo state)
|
public void TryStreamCopy(EncodingJobInfo state)
|
||||||
{
|
{
|
||||||
if (state.VideoStream != null && CanStreamCopyVideo(state, state.VideoStream))
|
if (state.VideoStream != null && CanStreamCopyVideo(state, state.VideoStream))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user