diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 49d5f1c8d..bab0d1a6e 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -877,14 +877,6 @@ namespace MediaBrowser.Api.Playback
return "copy";
}
- private bool SupportsThrottleWithStream
- {
- get
- {
- return false;
- }
- }
-
///
/// Gets the input argument.
///
@@ -908,23 +900,15 @@ namespace MediaBrowser.Api.Playback
private string GetInputPathArgument(string transcodingJobId, StreamState state)
{
- if (state.InputProtocol == MediaProtocol.File &&
- state.RunTimeTicks.HasValue &&
- state.VideoType == VideoType.VideoFile &&
- !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- if (state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && state.IsInputVideo)
- {
- if (SupportsThrottleWithStream)
- {
- var url = "http://localhost:" + ServerConfigurationManager.Configuration.HttpServerPortNumber.ToString(UsCulture) + "/videos/" + state.Request.Id + "/stream?static=true&Throttle=true&mediaSourceId=" + state.Request.MediaSourceId;
-
- url += "&transcodingJobId=" + transcodingJobId;
-
- return string.Format("\"{0}\"", url);
- }
- }
- }
+ //if (state.InputProtocol == MediaProtocol.File &&
+ // state.RunTimeTicks.HasValue &&
+ // state.VideoType == VideoType.VideoFile &&
+ // !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ //{
+ // if (state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && state.IsInputVideo)
+ // {
+ // }
+ //}
var protocol = state.InputProtocol;
diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index 9dbe3389e..09f1ab567 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -153,49 +153,12 @@ namespace MediaBrowser.Api.Playback.Progressive
using (state)
{
- var job = string.IsNullOrEmpty(request.TranscodingJobId) ?
- null :
- ApiEntryPoint.Instance.GetTranscodingJob(request.TranscodingJobId);
-
- var limits = new List();
- if (state.InputBitrate.HasValue)
- {
- // Bytes per second
- limits.Add((state.InputBitrate.Value / 8));
- }
- if (state.InputFileSize.HasValue && state.RunTimeTicks.HasValue)
- {
- var totalSeconds = TimeSpan.FromTicks(state.RunTimeTicks.Value).TotalSeconds;
-
- if (totalSeconds > 1)
- {
- var timeBasedLimit = state.InputFileSize.Value / totalSeconds;
- limits.Add(Convert.ToInt64(timeBasedLimit));
- }
- }
-
- // Take the greater of the above to methods, just to be safe
- var throttleLimit = limits.Count > 0 ? limits.First() : 0;
-
- // Pad to play it safe
- var bytesPerSecond = Convert.ToInt64(1.05 * throttleLimit);
-
- // Don't even start evaluating this until at least two minutes have content have been consumed
- var targetGap = throttleLimit * 120;
-
return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
{
ResponseHeaders = responseHeaders,
ContentType = contentType,
IsHeadRequest = isHeadRequest,
- Path = state.MediaPath,
- Throttle = request.Throttle,
-
- ThrottleLimit = bytesPerSecond,
-
- MinThrottlePosition = targetGap,
-
- ThrottleCallback = (l1, l2) => ThrottleCallack(l1, l2, bytesPerSecond, job)
+ Path = state.MediaPath
});
}
}
@@ -238,6 +201,36 @@ namespace MediaBrowser.Api.Playback.Progressive
private long ThrottleCallack(long currentBytesPerSecond, long bytesWritten, long originalBytesPerSecond, TranscodingJob job)
{
+ //var job = string.IsNullOrEmpty(request.TranscodingJobId) ?
+ //null :
+ //ApiEntryPoint.Instance.GetTranscodingJob(request.TranscodingJobId);
+
+ //var limits = new List();
+ //if (state.InputBitrate.HasValue)
+ //{
+ // // Bytes per second
+ // limits.Add((state.InputBitrate.Value / 8));
+ //}
+ //if (state.InputFileSize.HasValue && state.RunTimeTicks.HasValue)
+ //{
+ // var totalSeconds = TimeSpan.FromTicks(state.RunTimeTicks.Value).TotalSeconds;
+
+ // if (totalSeconds > 1)
+ // {
+ // var timeBasedLimit = state.InputFileSize.Value / totalSeconds;
+ // limits.Add(Convert.ToInt64(timeBasedLimit));
+ // }
+ //}
+
+ //// Take the greater of the above to methods, just to be safe
+ //var throttleLimit = limits.Count > 0 ? limits.First() : 0;
+
+ //// Pad to play it safe
+ //var bytesPerSecond = Convert.ToInt64(1.05 * throttleLimit);
+
+ //// Don't even start evaluating this until at least two minutes have content have been consumed
+ //var targetGap = throttleLimit * 120;
+
var bytesDownloaded = job.BytesDownloaded ?? 0;
var transcodingPositionTicks = job.TranscodingPositionTicks ?? 0;
var downloadPositionTicks = job.DownloadPositionTicks ?? 0;
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index dc22fc754..907b17b24 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -72,7 +72,6 @@ namespace MediaBrowser.Api.Playback
public string Params { get; set; }
public string ClientTime { get; set; }
- public bool Throttle { get; set; }
public string TranscodingJobId { get; set; }
}
diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.cs
index 5bb2c9a5c..6a104554a 100644
--- a/MediaBrowser.Controller/Net/StaticResultOptions.cs
+++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs
@@ -18,11 +18,6 @@ namespace MediaBrowser.Controller.Net
public IDictionary ResponseHeaders { get; set; }
- public bool Throttle { get; set; }
- public long ThrottleLimit { get; set; }
- public long MinThrottlePosition { get; set; }
- public Func ThrottleCallback { get; set; }
-
public Action OnComplete { get; set; }
public StaticResultOptions()
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
index ffae8612e..ead080c60 100644
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
@@ -452,24 +452,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
private string GetInputPathArgument(EncodingJob job)
{
- //if (job.InputProtocol == MediaProtocol.File &&
- // job.RunTimeTicks.HasValue &&
- // job.VideoType == VideoType.VideoFile &&
- // !string.Equals(job.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
- //{
- // if (job.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && job.IsInputVideo)
- // {
- // if (SupportsThrottleWithStream)
- // {
- // var url = "http://localhost:" + ServerConfigurationManager.Configuration.HttpServerPortNumber.ToString(UsCulture) + "/videos/" + job.Request.Id + "/stream?static=true&Throttle=true&mediaSourceId=" + job.Request.MediaSourceId;
-
- // url += "&transcodingJobId=" + transcodingJobId;
-
- // return string.Format("\"{0}\"", url);
- // }
- // }
- //}
-
var protocol = job.InputProtocol;
var inputPath = new[] { job.MediaPath };
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index 681d3ac5e..ecf58e4a6 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -461,10 +461,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
return new RangeRequestWriter(rangeHeader, stream, contentType, isHeadRequest)
{
- Throttle = options.Throttle,
- ThrottleLimit = options.ThrottleLimit,
- MinThrottlePosition = options.MinThrottlePosition,
- ThrottleCallback = options.ThrottleCallback,
OnComplete = options.OnComplete
};
}
@@ -480,10 +476,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return new StreamWriter(stream, contentType, _logger)
{
- Throttle = options.Throttle,
- ThrottleLimit = options.ThrottleLimit,
- MinThrottlePosition = options.MinThrottlePosition,
- ThrottleCallback = options.ThrottleCallback,
OnComplete = options.OnComplete
};
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
index cdd4c6d7c..8c72f9e7e 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
@@ -24,10 +24,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private long RangeLength { get; set; }
private long TotalContentLength { get; set; }
- public bool Throttle { get; set; }
- public long ThrottleLimit { get; set; }
- public long MinThrottlePosition;
- public Func ThrottleCallback { get; set; }
public Action OnComplete { get; set; }
///
@@ -165,14 +161,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// The response stream.
public void WriteTo(Stream responseStream)
{
- if (Throttle)
- {
- responseStream = new ThrottledStream(responseStream, ThrottleLimit)
- {
- MinThrottlePosition = MinThrottlePosition,
- ThrottleCallback = ThrottleCallback
- };
- }
WriteToInternal(responseStream);
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
index 1db14e887..fe662542e 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
@@ -35,10 +35,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
get { return _options; }
}
- public bool Throttle { get; set; }
- public long ThrottleLimit { get; set; }
- public long MinThrottlePosition;
- public Func ThrottleCallback { get; set; }
public Action OnComplete { get; set; }
///
@@ -82,14 +78,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// The response stream.
public void WriteTo(Stream responseStream)
{
- if (Throttle)
- {
- responseStream = new ThrottledStream(responseStream, ThrottleLimit)
- {
- MinThrottlePosition = MinThrottlePosition,
- ThrottleCallback = ThrottleCallback
- };
- }
WriteToInternal(responseStream);
}