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