diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-01-31 22:33:08 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-01-31 22:33:08 -0500 |
| commit | 599c898c0c063440f4129b0c2cbce31ea51e33dc (patch) | |
| tree | 1bbeec0f5f1eda10a0b6ce604782d2aef44fcee6 /MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | |
| parent | a85cc6db21ec6a68f772c834df2ca201aec08692 (diff) | |
| parent | e7037a9b80843c127712f11430239f8fa3cb4aed (diff) | |
Merge pull request #996 from MediaBrowser/master
Merge master changes
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index cf31afd5d..d631cab98 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -503,7 +503,21 @@ namespace MediaBrowser.MediaEncoding.Encoder process.Start(); - var ranToCompletion = process.WaitForExit(120000); + // Need to give ffmpeg enough time to make all the thumbnails, which could be a while, + // but we still need to detect if the process hangs. + // Making the assumption that as long as new jpegs are showing up, everything is good. + + bool isResponsive = true; + int lastCount = 0; + + while (isResponsive && !process.WaitForExit(120000)) + { + int jpegCount = Directory.GetFiles(targetDirectory, "*.jpg").Count(); + isResponsive = (jpegCount > lastCount); + lastCount = jpegCount; + } + + bool ranToCompletion = process.HasExited; if (!ranToCompletion) { |
