Merge pull request #1117 from Bond-009/ffmpeg
Check before flushing ffmpeg log
This commit is contained in:
commit
c7e7aa0a61
|
@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
public class JobLogger
|
public class JobLogger
|
||||||
{
|
{
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private static readonly CultureInfo _usCulture = CultureInfo.ReadOnly(new CultureInfo("en-US"));
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public JobLogger(ILogger logger)
|
public JobLogger(ILogger logger)
|
||||||
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
using (var reader = new StreamReader(source))
|
using (var reader = new StreamReader(source))
|
||||||
{
|
{
|
||||||
while (!reader.EndOfStream)
|
while (!reader.EndOfStream && reader.BaseStream.CanRead)
|
||||||
{
|
{
|
||||||
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -39,6 +39,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
|
|
||||||
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
||||||
|
|
||||||
|
// Check again, the stream could have been closed
|
||||||
|
if (!target.CanWrite)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
await target.FlushAsync().ConfigureAwait(false);
|
await target.FlushAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user