diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-04-13 15:14:37 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-04-13 15:14:37 -0400 |
| commit | 1fdaee1bb9935092e15cff3bbb8a976c811b0e4a (patch) | |
| tree | 6febe5896ac3ca916e5c7cde139cf220945472c4 /MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | |
| parent | 88897141b0f10b1335fefde5568d372d7e22af86 (diff) | |
fix hls seeking
Diffstat (limited to 'MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 455113da9..c06bbe143 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -127,9 +127,27 @@ namespace MediaBrowser.Api.Playback.Hls } else { + var startTranscoding = false; + var currentTranscodingIndex = GetCurrentTranscodingIndex(playlistPath, segmentExtension); - var segmentGapRequiringTranscodingChange = 24/state.SegmentLength; - if (currentTranscodingIndex == null || requestedIndex < currentTranscodingIndex.Value || (requestedIndex - currentTranscodingIndex.Value) > segmentGapRequiringTranscodingChange) + var segmentGapRequiringTranscodingChange = 24 / state.SegmentLength; + + if (currentTranscodingIndex == null) + { + Logger.Debug("Starting transcoding because currentTranscodingIndex=null"); + startTranscoding = true; + } + else if (requestedIndex < currentTranscodingIndex.Value) + { + Logger.Debug("Starting transcoding because requestedIndex={0} and currentTranscodingIndex={1}", requestedIndex, currentTranscodingIndex); + startTranscoding = true; + } + else if ((requestedIndex - currentTranscodingIndex.Value) > segmentGapRequiringTranscodingChange) + { + Logger.Debug("Starting transcoding because segmentGap is {0} and max allowed gap is {1}. requestedIndex={2}", (requestedIndex - currentTranscodingIndex.Value), segmentGapRequiringTranscodingChange, requestedIndex); + startTranscoding = true; + } + if (startTranscoding) { // If the playlist doesn't already exist, startup ffmpeg try @@ -151,7 +169,7 @@ namespace MediaBrowser.Api.Playback.Hls throw; } - await WaitForMinimumSegmentCount(playlistPath, 1, cancellationTokenSource.Token).ConfigureAwait(false); + //await WaitForMinimumSegmentCount(playlistPath, 1, cancellationTokenSource.Token).ConfigureAwait(false); } else { |
