mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
Move the check further down
This commit is contained in:
parent
96b3d37caf
commit
547d0ecf58
1 changed files with 7 additions and 2 deletions
|
@ -24,8 +24,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
using (var reader = new StreamReader(source))
|
using (var reader = new StreamReader(source))
|
||||||
{
|
{
|
||||||
// If ffmpeg process is closed, the state is disposed, so don't write to target in that case
|
while (!reader.EndOfStream)
|
||||||
while (!reader.EndOfStream && target.CanWrite)
|
|
||||||
{
|
{
|
||||||
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
var line = await reader.ReadLineAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -33,6 +32,12 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue