aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Subtitles/SubtitleService.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-20 21:16:28 -0500
committerGitHub <noreply@github.com>2019-01-20 21:16:28 -0500
commit920c39454c05e979eabe81877269cd4517a03ccf (patch)
treeeed6621d17277b4ac939395a61c51f6fe16b3e14 /MediaBrowser.Api/Subtitles/SubtitleService.cs
parent27f0633ed82228127ddaab2bd5eb8b844a2c8ed6 (diff)
parent3069c749b4f757672269efbbf2682bc0c93e19e9 (diff)
Merge pull request #646 from Tthecreator/master
Fix infinite loop bug on subtitle.m3u8 request
Diffstat (limited to 'MediaBrowser.Api/Subtitles/SubtitleService.cs')
-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;