From 6a9dbf6ae85b4e7abcf06f7f29ef9d8b0b890876 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 29 Aug 2014 08:14:41 -0400 Subject: update translations --- .../HttpServer/StreamWriter.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs') diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs index a8774f1b7..f1112ae0b 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs @@ -36,6 +36,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer get { return _options; } } + public bool Throttle { get; set; } + public long ThrottleLimit { get; set; } + /// /// Initializes a new instance of the class. /// @@ -77,6 +80,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// The response stream. public void WriteTo(Stream responseStream) { + if (Throttle) + { + responseStream = new ThrottledStream(responseStream, ThrottleLimit) + { + MinThrottlePosition = ThrottleLimit * 180 + }; + } var task = WriteToAsync(responseStream); Task.WaitAll(task); @@ -98,7 +108,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer } catch (Exception ex) { - Logger.ErrorException("Error streaming media", ex); + Logger.ErrorException("Error streaming data", ex); throw; } -- cgit v1.2.3