-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(HLS): Only offset segment ref times when needed w/ EXT-X-MEDIA-SEQUENCE #6378
Conversation
Incremental code coverage: 100.00% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add a test to avoid regressions in the future! Thanks!
Looks simple enough. But please add tests, and please add more detail in the PR description to help others understand the problem and how this solves it. Thanks! |
…e to a warning instead.
@JulianDomingo can you fix the build errors? Thanks! |
Done, I've updated the PR description and added unit tests. Fixed lint errors as well. |
@JulianDomingo Please, fix the tests |
…*before* the playlist update occurs.
Done; I mistakenly placed the initial assertion after the live playlist update occurs, which was not the intention. |
…QUENCE (#6378) Fixes #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 #2 (what happens now) EXT-X-MEDIA-SEQUENCE Media Time 6 0 7 6 8 12 9 18 Playlist download #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.
…QUENCE (#6378) Fixes #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 #2 (what happens now) EXT-X-MEDIA-SEQUENCE Media Time 6 0 7 6 8 12 9 18 Playlist download #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.
…QUENCE (#6378) Fixes #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 #2 (what happens now) EXT-X-MEDIA-SEQUENCE Media Time 6 0 7 6 8 12 9 18 Playlist download #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.
Fixes #6377
When choosing to synchronize HLS streams using
EXT-X-MEDIA-SEQUENCE
instead ofEXT-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 time0
:shaka-player/lib/hls/hls_parser.js
Lines 610 to 613 in ea740ba
This is problematic, as the
StreamingEngine
's media time used to download new segments is based off the latest segment references:shaka-player/lib/media/streaming_engine.js
Lines 1248 to 1250 in ea740ba
shaka-player/lib/media/streaming_engine.js
Line 1385 in ea740ba
For example:
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 totime=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.