Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(HLS): Only offset segment ref times when needed w/ EXT-X-MEDIA-SE…
…QUENCE (shaka-project#6378) Fixes shaka-project#6377 When choosing to synchronize HLS streams using `EXT-X-MEDIA-SEQUENCE` instead of `EXT-X-PROGRAM-DATE-TIME` during LIVE playlist variant switches, Shaka unnecessarily drops 'old' segments and offsets the segment references of the new playlist so that the earliest reference represents media time `0`: https://github.com/shaka-project/shaka-player/blob/ea740ba2468f3b035d463ea9933aa7eeccf5c748/lib/hls/hls_parser.js#L610-L613 This is problematic, as the `StreamingEngine`'s media time used to download new segments is based off the latest segment references: https://github.com/shaka-project/shaka-player/blob/ea740ba2468f3b035d463ea9933aa7eeccf5c748/lib/media/streaming_engine.js#L1248-L1250 https://github.com/shaka-project/shaka-player/blob/ea740ba2468f3b035d463ea9933aa7eeccf5c748/lib/media/streaming_engine.js#L1385 For example: ``` Playlist download #1 EXT-X-MEDIA-SEQUENCE Media Time 0 0 1 6 2 12 3 18 Playlist download shaka-project#2 (what happens now) EXT-X-MEDIA-SEQUENCE Media Time 6 0 7 6 8 12 9 18 Playlist download shaka-project#2 (desired behavior) EXT-X-MEDIA-SEQUENCE Media Time 6 36 7 42 8 48 9 54 ``` Without this fix, and given the above example, if Shaka tries to request the segment at `time=36`, it will fail because the media state only has segment references up to `time=18`. Until the manifests, 'catch up', the player freezes; this can be especially problematic when a large amount of time accumulates before a variant switch occurs. This has been confirmed by Pluto TV to fix their freezing issues.
- Loading branch information