From 7bcb86e5103ecc6d4ce09498899650493fb88557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Wed, 5 Jun 2024 14:36:41 +0200 Subject: [PATCH] fix(HLS): Fix seekRange when using delta playlist (#6758) Only happens when we use `useSafariBehaviorForLive = false`. --- lib/hls/hls_parser.js | 2 +- test/hls/hls_live_unit.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 85e9b2114a..94ebc02b89 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -493,7 +493,7 @@ shaka.hls.HlsParser = class { mediaSequenceNumber); stream.segmentIndex.evict(playlistStartTime); } - const oldSegment = segments[0]; + const oldSegment = stream.segmentIndex.earliestReference(); goog.asserts.assert(oldSegment, 'Should have segments!'); streamInfo.minTimestamp = oldSegment.startTime; diff --git a/test/hls/hls_live_unit.js b/test/hls/hls_live_unit.js index 51bd98fa53..04f759e76b 100644 --- a/test/hls/hls_live_unit.js +++ b/test/hls/hls_live_unit.js @@ -1110,6 +1110,8 @@ describe('HlsParser live', () => { '#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-UNTIL=60.0,\n', '#EXT-X-SKIP:SKIPPED-SEGMENTS=1\n', '#EXTINF:2,\n', + 'main1.mp4\n', + '#EXTINF:2,\n', 'main2.mp4\n', ].join(''); @@ -1121,6 +1123,8 @@ describe('HlsParser live', () => { '#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-UNTIL=60.0,\n', '#EXT-X-SKIP:SKIPPED-SEGMENTS=1\n', '#EXTINF:2,\n', + 'main2.mp4\n', + '#EXTINF:2,\n', 'main3.mp4\n', ].join(''); @@ -1128,7 +1132,7 @@ describe('HlsParser live', () => { 'test:/video?_HLS_msn=2&_HLS_skip=YES', mediaWithSkippedSegments1); fakeNetEngine.setResponseText( - 'test:/video?_HLS_msn=3&_HLS_skip=YES', mediaWithSkippedSegments2); + 'test:/video?_HLS_msn=4&_HLS_skip=YES', mediaWithSkippedSegments2); playerInterface.isLowLatencyMode = () => true; @@ -1145,7 +1149,7 @@ describe('HlsParser live', () => { await delayForUpdatePeriod(); fakeNetEngine.expectRequest( - 'test:/video?_HLS_msn=3&_HLS_skip=YES', + 'test:/video?_HLS_msn=4&_HLS_skip=YES', shaka.net.NetworkingEngine.RequestType.MANIFEST, {type: shaka.net.NetworkingEngine.AdvancedRequestType.MEDIA_PLAYLIST});