Merge pull request #8516 from cvium/kill_ffprobe_when_extraction_crashes

This commit is contained in:
Claus Vium 2022-10-09 08:27:34 +02:00 committed by GitHub
commit 6d23de64c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,10 +38,29 @@ public static class FfProbeKeyframeExtractor
EnableRaisingEvents = true
};
try
{
process.Start();
return ParseStream(process.StandardOutput);
}
catch (Exception)
{
try
{
if (!process.HasExited)
{
process.Kill();
}
}
catch
{
// We do not care if this fails
}
throw;
}
}
internal static KeyframeData ParseStream(StreamReader reader)
{