Merge pull request #995 from Bluebull32/Bluebull32-patch-1

Bluebull32 patch 1
This commit is contained in:
Luke 2015-01-31 15:10:42 -05:00
commit e7037a9b80
2 changed files with 16 additions and 2 deletions

View File

@ -155,7 +155,7 @@ namespace MediaBrowser.Api.Playback
private byte[] GetBytes(int value) private byte[] GetBytes(int value)
{ {
byte[] bytes = BitConverter.GetBytes(value); byte[] bytes = BitConverter.GetBytes(value);
if (BitConverter.IsLittleEndian) if (!BitConverter.IsLittleEndian)
Array.Reverse(bytes); Array.Reverse(bytes);
return bytes; return bytes;
} }

View File

@ -501,7 +501,21 @@ namespace MediaBrowser.MediaEncoding.Encoder
process.Start(); 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) if (!ranToCompletion)
{ {