mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update media probe
This commit is contained in:
parent
a9cc5d5c44
commit
7e1a0baf9b
@ -500,7 +500,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
// Must consume both or ffmpeg may hang due to deadlocks. See comments below.
|
// Must consume both or ffmpeg may hang due to deadlocks. See comments below.
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
//RedirectStandardError = true,
|
//RedirectStandardError = true,
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = false,
|
||||||
FileName = FFProbePath,
|
FileName = FFProbePath,
|
||||||
Arguments = string.Format(args,
|
Arguments = string.Format(args,
|
||||||
probeSizeArgument, inputPath).Trim(),
|
probeSizeArgument, inputPath).Trim(),
|
||||||
@ -514,7 +514,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
using (var processWrapper = new ProcessWrapper(process, this, _logger, false))
|
||||||
{
|
{
|
||||||
await _ffProbeResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _ffProbeResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
// Must consume both or ffmpeg may hang due to deadlocks. See comments below.
|
// Must consume both or ffmpeg may hang due to deadlocks. See comments below.
|
||||||
//RedirectStandardOutput = true,
|
//RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = false,
|
||||||
FileName = FFMpegPath,
|
FileName = FFMpegPath,
|
||||||
Arguments = string.Format(args, probeSizeArgument, inputPath, videoStream.Index.ToString(CultureInfo.InvariantCulture)).Trim(),
|
Arguments = string.Format(args, probeSizeArgument, inputPath, videoStream.Index.ToString(CultureInfo.InvariantCulture)).Trim(),
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
var idetFoundInterlaced = false;
|
var idetFoundInterlaced = false;
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
using (var processWrapper = new ProcessWrapper(process, this, _logger, false))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -898,14 +898,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
FileName = FFMpegPath,
|
FileName = FFMpegPath,
|
||||||
Arguments = args,
|
Arguments = args,
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
ErrorDialog = false,
|
ErrorDialog = false
|
||||||
RedirectStandardInput = true
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
using (var processWrapper = new ProcessWrapper(process, this, _logger, false))
|
||||||
{
|
{
|
||||||
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -1010,7 +1009,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
bool ranToCompletion = false;
|
bool ranToCompletion = false;
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
using (var processWrapper = new ProcessWrapper(process, this, _logger, true))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1118,13 +1117,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
{
|
{
|
||||||
_logger.Info("Killing ffmpeg process");
|
_logger.Info("Killing ffmpeg process");
|
||||||
|
|
||||||
try
|
if (process.IsRedirectingStdin)
|
||||||
{
|
{
|
||||||
process.Process.StandardInput.WriteLine("q");
|
try
|
||||||
}
|
{
|
||||||
catch (Exception)
|
process.Process.StandardInput.WriteLine("q");
|
||||||
{
|
}
|
||||||
_logger.Error("Error sending q command to process");
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_logger.Error("Error sending q command to process");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -1201,13 +1203,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
public int? ExitCode;
|
public int? ExitCode;
|
||||||
private readonly MediaEncoder _mediaEncoder;
|
private readonly MediaEncoder _mediaEncoder;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
public bool IsRedirectingStdin { get; set; }
|
||||||
|
|
||||||
public ProcessWrapper(Process process, MediaEncoder mediaEncoder, ILogger logger)
|
public ProcessWrapper(Process process, MediaEncoder mediaEncoder, ILogger logger, bool isRedirectingStdin)
|
||||||
{
|
{
|
||||||
Process = process;
|
Process = process;
|
||||||
_mediaEncoder = mediaEncoder;
|
_mediaEncoder = mediaEncoder;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
Process.Exited += Process_Exited;
|
Process.Exited += Process_Exited;
|
||||||
|
IsRedirectingStdin = isRedirectingStdin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process_Exited(object sender, EventArgs e)
|
void Process_Exited(object sender, EventArgs e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user