mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 04:48:27 +01:00
restore nuget targets for mono build
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using ServiceStack.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -73,7 +74,10 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
}
|
||||
finally
|
||||
{
|
||||
ApiEntryPoint.Instance.OnTranscodeEndRequest(Path, TranscodingJobType.Progressive);
|
||||
if (_job != null)
|
||||
{
|
||||
ApiEntryPoint.Instance.OnTranscodeEndRequest(_job);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,6 +87,8 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly TranscodingJob _job;
|
||||
|
||||
private long _bytesWritten = 0;
|
||||
|
||||
public ProgressiveFileCopier(IFileSystem fileSystem, TranscodingJob job)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
@@ -98,7 +104,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
{
|
||||
while (eofCount < 15)
|
||||
{
|
||||
await fs.CopyToAsync(outputStream).ConfigureAwait(false);
|
||||
await CopyToAsyncInternal(fs, outputStream, 81920, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
var fsPosition = fs.Position;
|
||||
|
||||
@@ -123,5 +129,22 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CopyToAsyncInternal(Stream source, Stream destination, int bufferSize, CancellationToken cancellationToken)
|
||||
{
|
||||
byte[] array = new byte[bufferSize];
|
||||
int count;
|
||||
while ((count = await source.ReadAsync(array, 0, array.Length, cancellationToken).ConfigureAwait(false)) != 0)
|
||||
{
|
||||
await destination.WriteAsync(array, 0, count, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
_bytesWritten += count;
|
||||
|
||||
if (_job != null)
|
||||
{
|
||||
_job.BytesDownloaded = Math.Max(_job.BytesDownloaded ?? _bytesWritten, _bytesWritten);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user