-
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): Fix load of LL-HLS when the partial segment is not independent #5277
fix(HLS): Fix load of LL-HLS when the partial segment is not independent #5277
Conversation
@@ -1262,6 +1262,17 @@ shaka.media.StreamingEngine = class { | |||
mediaState.stream.segmentIndex.getIteratorForTime(presentationTime); | |||
ref = mediaState.segmentIterator && | |||
mediaState.segmentIterator.next().value; | |||
// For LL-HLS we need to find the nearest INDEPENDENT segment |
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.
Oh hey, while examining this code, I found a JSDoc problem!
In the definition for shaka.media.StreamingEngine.MediaState_
, we refer to segmentIterator
as being a shaka.media.SegmentIndexIterator
object at one point. That should be shaka.media.SegmentIterator
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 think that the definition is true, because it's used in other parts and it works, It's a private definition
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.
The reason that it works is that the JSDoc lists it as a shaka.media.SegmentIndexIterator
, but the @typedef
above correctly lists it as a shaka.media.SegmentIterator
. I think?
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'm not sure... but it works :S
let attempt = 0; | ||
const maxAttempts = 5; | ||
while (ref && !ref.isIndependent() && attempt < maxAttempts) { | ||
const newTime = ref.startTime - 0.1; |
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.
Is looking back 0.1s 5 times the correct way to do this?
Looking at Apple's sample manifest here:
https://developer.apple.com/documentation/http-live-streaming/enabling-low-latency-http-live-streaming-hls
They only seem to have an INDEPENDENT
part every 1.3 seconds at best. So this might potentially miss an independent part, depending on the exact time this falls on, right?
If it's possible to have a part that has a duration that is <100ms, this approach could also be a problem the other way; that is to say, there might be the potential of "skipping over" the independent part.
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.
No, It's going to back 5 times, but from previous start time less 0.1 second to find the previous segment. Example:
- Segment 1 --> StartTime 0 EndTime 1, INDEPENDENT
- Segment 2 --> StartTime 1 EndTime 2
- Segment 3 --> StartTime 2 EndTime 3
If presentationTime = 3;
initial choice = Segment 3
1st loop
2-0.1 --> Segment 2
2nd loop
1-0.1 --> Segment 1 INDEPENDENT
So the loop is not 0.1 * 5ms, depends of previous segments
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.
Ah, I see what you mean. I hadn't been thinking about it correctly.
Incremental code coverage: 76.67% |
@@ -1262,6 +1262,17 @@ shaka.media.StreamingEngine = class { | |||
mediaState.stream.segmentIndex.getIteratorForTime(presentationTime); | |||
ref = mediaState.segmentIterator && | |||
mediaState.segmentIterator.next().value; | |||
// For LL-HLS we need to find the nearest INDEPENDENT segment |
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.
The reason that it works is that the JSDoc lists it as a shaka.media.SegmentIndexIterator
, but the @typedef
above correctly lists it as a shaka.media.SegmentIterator
. I think?
let attempt = 0; | ||
const maxAttempts = 5; | ||
while (ref && !ref.isIndependent() && attempt < maxAttempts) { | ||
const newTime = ref.startTime - 0.1; |
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.
Ah, I see what you mean. I hadn't been thinking about it correctly.
No description provided.