From 386ed8d34a154766ff202ef86719bed5c89b2ff2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 1 Jun 2017 01:05:36 -0400 Subject: update live stream buffers --- MediaBrowser.Controller/IO/StreamHelper.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'MediaBrowser.Controller/IO') diff --git a/MediaBrowser.Controller/IO/StreamHelper.cs b/MediaBrowser.Controller/IO/StreamHelper.cs index 168d4b8c6..af97a0233 100644 --- a/MediaBrowser.Controller/IO/StreamHelper.cs +++ b/MediaBrowser.Controller/IO/StreamHelper.cs @@ -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; + } } } } -- cgit v1.2.3