mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 18:14:42 +01:00
update live stream buffers
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.IO
|
||||
{
|
||||
public static class StreamHelper
|
||||
{
|
||||
public static void CopyTo(Stream source, Stream destination, int bufferSize, CancellationToken cancellationToken)
|
||||
{
|
||||
CopyTo(source, destination, bufferSize, null, cancellationToken);
|
||||
}
|
||||
|
||||
public static void CopyTo(Stream source, Stream destination, int bufferSize, Action onStarted, CancellationToken cancellationToken)
|
||||
{
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
int read;
|
||||
@@ -14,6 +20,12 @@ namespace MediaBrowser.Controller.IO
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
destination.Write(buffer, 0, read);
|
||||
|
||||
if (onStarted != null)
|
||||
{
|
||||
onStarted();
|
||||
onStarted = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user