diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-01-31 15:10:42 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-01-31 15:10:42 -0500 |
| commit | e7037a9b80843c127712f11430239f8fa3cb4aed (patch) | |
| tree | 0116f992c91896ac4b491612450ce5e60ffcb8be | |
| parent | f3e98dde6a82a28e5ba1c8eb2cd57eb5a41d0bd3 (diff) | |
| parent | 9b41a0001c67421493a5ac17caf8b37e56c2156d (diff) | |
Merge pull request #995 from Bluebull32/Bluebull32-patch-1
Bluebull32 patch 1
| -rw-r--r-- | MediaBrowser.Api/Playback/BifService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/MediaBrowser.Api/Playback/BifService.cs b/MediaBrowser.Api/Playback/BifService.cs index 057d81441..181cdfe89 100644 --- a/MediaBrowser.Api/Playback/BifService.cs +++ b/MediaBrowser.Api/Playback/BifService.cs @@ -155,7 +155,7 @@ namespace MediaBrowser.Api.Playback private byte[] GetBytes(int value) { byte[] bytes = BitConverter.GetBytes(value); - if (BitConverter.IsLittleEndian) + if (!BitConverter.IsLittleEndian) Array.Reverse(bytes); return bytes; } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index e800b4254..a4ab1c551 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -501,7 +501,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) { |
