Merge pull request #999 from cvium/dont_write_disposed_log
Check that ffmpeg log target isn't disposed before writing to it
This commit is contained in:
commit
ba78f6a0ff
|
@ -32,16 +32,17 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);
|
var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);
|
||||||
|
|
||||||
|
// If ffmpeg process is closed, the state is disposed, so don't write to target in that case
|
||||||
|
if (!target.CanWrite)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
|
||||||
await target.FlushAsync().ConfigureAwait(false);
|
await target.FlushAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
//TODO Investigate and properly fix.
|
|
||||||
// Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error reading ffmpeg log");
|
_logger.LogError(ex, "Error reading ffmpeg log");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user