mirror of https://github.com/jellyfin/jellyfin
Add subtitle extraction timeout configuration option
This commit is contained in:
parent
b8327dbc9f
commit
5182aec13f
|
|
@ -13,8 +13,10 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using AsyncKeyedLock;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
|
@ -37,6 +39,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
private readonly IMediaSourceManager _mediaSourceManager;
|
||||
private readonly ISubtitleParser _subtitleParser;
|
||||
private readonly IPathManager _pathManager;
|
||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _semaphoreLocks.
|
||||
|
|
@ -54,7 +57,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
IHttpClientFactory httpClientFactory,
|
||||
IMediaSourceManager mediaSourceManager,
|
||||
ISubtitleParser subtitleParser,
|
||||
IPathManager pathManager)
|
||||
IPathManager pathManager,
|
||||
IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
|
|
@ -63,6 +67,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
_mediaSourceManager = mediaSourceManager;
|
||||
_subtitleParser = subtitleParser;
|
||||
_pathManager = pathManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
}
|
||||
|
||||
private MemoryStream ConvertSubtitles(
|
||||
|
|
@ -394,7 +399,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
try
|
||||
{
|
||||
await process.WaitForExitAsync(TimeSpan.FromMinutes(30)).ConfigureAwait(false);
|
||||
var timeoutMinutes = _serverConfigurationManager.GetEncodingOptions().SubtitleExtractionTimeoutMinutes;
|
||||
await process.WaitForExitAsync(TimeSpan.FromMinutes(timeoutMinutes)).ConfigureAwait(false);
|
||||
exitCode = process.ExitCode;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
|
@ -677,7 +683,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
try
|
||||
{
|
||||
await process.WaitForExitAsync(TimeSpan.FromMinutes(30)).ConfigureAwait(false);
|
||||
var timeoutMinutes = _serverConfigurationManager.GetEncodingOptions().SubtitleExtractionTimeoutMinutes;
|
||||
await process.WaitForExitAsync(TimeSpan.FromMinutes(timeoutMinutes)).ConfigureAwait(false);
|
||||
exitCode = process.ExitCode;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
|
@ -828,7 +835,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
try
|
||||
{
|
||||
await process.WaitForExitAsync(TimeSpan.FromMinutes(30)).ConfigureAwait(false);
|
||||
var timeoutMinutes = _serverConfigurationManager.GetEncodingOptions().SubtitleExtractionTimeoutMinutes;
|
||||
await process.WaitForExitAsync(TimeSpan.FromMinutes(timeoutMinutes)).ConfigureAwait(false);
|
||||
exitCode = process.ExitCode;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public class EncodingOptions
|
|||
AllowHevcEncoding = false;
|
||||
AllowAv1Encoding = false;
|
||||
EnableSubtitleExtraction = true;
|
||||
SubtitleExtractionTimeoutMinutes = 30;
|
||||
AllowOnDemandMetadataBasedKeyframeExtractionForExtensions = ["mkv"];
|
||||
HardwareDecodingCodecs = ["h264", "vc1"];
|
||||
}
|
||||
|
|
@ -286,6 +287,11 @@ public class EncodingOptions
|
|||
/// </summary>
|
||||
public bool EnableSubtitleExtraction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timeout for subtitle extraction in minutes.
|
||||
/// </summary>
|
||||
public int SubtitleExtractionTimeoutMinutes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the codecs hardware encoding is used for.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue