diff options
| author | 7illusions <z@7illusions.com> | 2014-08-30 19:06:58 +0200 |
|---|---|---|
| committer | 7illusions <z@7illusions.com> | 2014-08-30 19:06:58 +0200 |
| commit | 66ad1699e22029b605e17735e8d9450285d8748a (patch) | |
| tree | ffc92c88d24850b2f82b6b3a8bdd904a2ccc77a5 /MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs | |
| parent | 34bc54263e886aae777a3537dc50a6535b51330a (diff) | |
| parent | 9d36f518182bc075c19d78084870f5115fa62d1e (diff) | |
Merge pull request #1 from MediaBrowser/master
Update to latest
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs index a8774f1b7..28fc094f7 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs @@ -36,6 +36,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer get { return _options; } } + public bool Throttle { get; set; } + public long ThrottleLimit { get; set; } + public long MinThrottlePosition; + /// <summary> /// Initializes a new instance of the <see cref="StreamWriter" /> class. /// </summary> @@ -77,6 +81,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// <param name="responseStream">The response stream.</param> public void WriteTo(Stream responseStream) { + if (Throttle) + { + responseStream = new ThrottledStream(responseStream, ThrottleLimit) + { + MinThrottlePosition = MinThrottlePosition + }; + } var task = WriteToAsync(responseStream); Task.WaitAll(task); @@ -98,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer } catch (Exception ex) { - Logger.ErrorException("Error streaming media", ex); + Logger.ErrorException("Error streaming data", ex); throw; } |
