diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-06-01 03:57:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-01 03:57:22 -0400 |
| commit | 442d4e669969558256cf16f01a4018292609ba05 (patch) | |
| tree | 82131b8028197a4f5de7b7d3ce40fe61aa60da6a /MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | |
| parent | 1f5e51b6338096ef6f119802ea595c2cc30daf8e (diff) | |
| parent | b54b7871e39e197d4af19a6c502938fa6178c4fa (diff) | |
Merge pull request #2685 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 4003fb463..ddd2d8cd2 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -423,7 +423,7 @@ namespace MediaBrowser.Api.Playback.Hls return Path.Combine(folder, filename + index.ToString(UsCulture) + GetSegmentFileExtension(state.Request)); } - private async Task<object> GetSegmentResult(StreamState state, + private async Task<object> GetSegmentResult(StreamState state, string playlistPath, string segmentPath, string segmentExtension, @@ -456,26 +456,20 @@ namespace MediaBrowser.Api.Playback.Hls { try { - using (var fileStream = GetPlaylistFileStream(playlistPath)) + var text = FileSystem.ReadAllText(playlistPath, Encoding.UTF8); + + // If it appears in the playlist, it's done + if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1) { - using (var reader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize)) + if (!segmentFileExists) { - var text = await reader.ReadToEndAsync().ConfigureAwait(false); - - // If it appears in the playlist, it's done - if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1) - { - if (!segmentFileExists) - { - segmentFileExists = FileSystem.FileExists(segmentPath); - } - if (segmentFileExists) - { - return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false); - } - //break; - } + segmentFileExists = FileSystem.FileExists(segmentPath); + } + if (segmentFileExists) + { + return await GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob).ConfigureAwait(false); } + //break; } } catch (IOException) |
