-
Notifications
You must be signed in to change notification settings - Fork 425
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: llhls syncing fixes #1125
fix: llhls syncing fixes #1125
Conversation
b669420
to
4f842e6
Compare
Codecov Report
@@ Coverage Diff @@
## main #1125 +/- ##
==========================================
+ Coverage 86.20% 86.27% +0.06%
==========================================
Files 39 39
Lines 9289 9342 +53
Branches 2127 2149 +22
==========================================
+ Hits 8008 8060 +52
- Misses 1281 1282 +1
Continue to review full report at Codecov.
|
* @return {number} the number of seconds between startIndex and endIndex | ||
*/ | ||
export const sumDurations = function(playlist, startIndex, endIndex) { | ||
export const sumDurations = function({defaultDuration, durationList, startIndex, endIndex}) { |
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.
changes to allow passing in a list and a default duration. This allows us to use partsAndSegments
, just parts
, or just segments
|
||
let startIndex; | ||
|
||
for (let i = 0; i < partsAndSegments.length; i++) { |
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.
We have to find the partAndSegment index for the specified segment/part
}; | ||
} | ||
} | ||
|
||
// We are out of possible candidates so load the last one... | ||
return { | ||
mediaIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex, | ||
segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex, |
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.
renamed to segmentIndex as that is actually what this is.
src/playlist.js
Outdated
} | ||
|
||
// skip this if part index does not match. | ||
if (typeof partIndex === 'number' && typeof partAndSegment.partIndex === 'number' && partIndex !== partAndSegment.partIndex) { |
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.
question: why would partIndex
not be a number? Is it if it isn't present?
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.
I guess below I can see that it is default to null
. Maybe we should default it to -1
instead, that way we would only need to check partIndex !== partAndSegment.partIndex
?
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.
We ran into problems with mediaIndex being negative previously during live playlist updates. I wanted to avoid the whole issue with partIndex. The issue was something like: If we get a playlist update at just the right time we can end up downloading the same segment again because -1 + 1 = 0
. Using null we prevent choosing an incorrect segment via incrementing.
Co-authored-by: Gary Katsevman <[email protected]>
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.
Aside from my nitpick above, LGTM
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
Co-authored-by: Garrett Singer <[email protected]>
getMediaInfoForTime
,sync-controller
and other Playlist functions.