aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTthecreator <tpo.saedt@student.han.nl>2019-01-21 00:38:01 +0100
committerTthecreator <tpo.saedt@student.han.nl>2019-01-21 00:38:01 +0100
commitd02642bf7b35052229da816acb58301b5efa3a8e (patch)
tree028c2c1809dc6e274d5bf044abfbfb87560138a1
parent27f0633ed82228127ddaab2bd5eb8b844a2c8ed6 (diff)
Fixed bug where the server would eat up ram with subtitles request
-rw-r--r--MediaBrowser.Api/Subtitles/SubtitleService.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs
index 0e5b0a964..d1d3c3d8a 100644
--- a/MediaBrowser.Api/Subtitles/SubtitleService.cs
+++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Net;
@@ -156,14 +156,19 @@ namespace MediaBrowser.Api.Subtitles
throw new ArgumentException("HLS Subtitles are not supported for this media.");
}
+ var segmentLengthTicks = TimeSpan.FromSeconds(request.SegmentLength).Ticks;
+ if (segmentLengthTicks <= 0)
+ {
+ throw new ArgumentException("segmentLength was not given, or it was given incorrectly. (It should be bigger than 0)");
+ }
+
builder.AppendLine("#EXTM3U");
builder.AppendLine("#EXT-X-TARGETDURATION:" + request.SegmentLength.ToString(CultureInfo.InvariantCulture));
builder.AppendLine("#EXT-X-VERSION:3");
builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
- long positionTicks = 0;
- var segmentLengthTicks = TimeSpan.FromSeconds(request.SegmentLength).Ticks;
+ long positionTicks = 0;
var accessToken = _authContext.GetAuthorizationInfo(Request).Token;