3.0.5582.0

This commit is contained in:
Luke Pulverenti
2015-04-13 23:45:17 -04:00
parent 1fdaee1bb9
commit 5fe9b054c8
7 changed files with 34 additions and 15 deletions

View File

@@ -280,7 +280,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private async Task<List<int>> GetKeyFrames(string inputPath, int videoStreamIndex, CancellationToken cancellationToken)
{
const string args = "-i {0} -select_streams v:{1} -show_frames -print_format compact";
const string args = "-i {0} -select_streams v:{1} -show_frames -show_entries frame=pkt_dts,key_frame -print_format compact";
var process = new Process
{
@@ -310,15 +310,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
StartProcess(processWrapper);
var lines = new List<int>();
var outputCancellationSource = new CancellationTokenSource(4000);
try
{
process.BeginErrorReadLine();
var linkedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(outputCancellationSource.Token, cancellationToken);
await StartReadingOutput(process.StandardOutput.BaseStream, lines, 120000, outputCancellationSource, linkedCancellationTokenSource.Token).ConfigureAwait(false);
await StartReadingOutput(process.StandardOutput.BaseStream, lines, 120000, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
@@ -335,7 +332,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
return lines;
}
private async Task StartReadingOutput(Stream source, List<int> lines, int timeoutMs, CancellationTokenSource cancellationTokenSource, CancellationToken cancellationToken)
private async Task StartReadingOutput(Stream source, List<int> lines, int timeoutMs, CancellationToken cancellationToken)
{
try
{
@@ -362,11 +359,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
lines.Add(frameMs);
}
if (frameMs > timeoutMs)
{
cancellationTokenSource.Cancel();
}
}
}
}