From d02642bf7b35052229da816acb58301b5efa3a8e Mon Sep 17 00:00:00 2001 From: Tthecreator Date: Mon, 21 Jan 2019 00:38:01 +0100 Subject: [PATCH 1/2] Fixed bug where the server would eat up ram with subtitles request --- MediaBrowser.Api/Subtitles/SubtitleService.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index 0e5b0a9640..d1d3c3d8a3 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; From 3069c749b4f757672269efbbf2682bc0c93e19e9 Mon Sep 17 00:00:00 2001 From: Tthecreator Date: Mon, 21 Jan 2019 00:40:59 +0100 Subject: [PATCH 2/2] Added myself to contributers --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 80c1723091..cd55379799 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -11,6 +11,7 @@ - [AnthonyLavado](https://github.com/anthonylavado) - [sparky8251](https://github.com/sparky8251) - [LeoVerto](https://github.com/LeoVerto) + - [TtheCreator](https://github.com/Tthecreator) # Emby Contributors