fix(live): only reset playlist loader for LLHLS #1410
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
After a LOT of debugging with playlist changes against a linear DASH stream, I discovered we're calling
resetLoader
when setting a new playlist (during a rendition switch), which setsfetchAtBuffer_
to false then callsresyncLoader
. This sets themediaIndex
to null, which eventually on the nextchooseNextRequest_
call (which as implied, chooses the next segment to request) forces us into the else logic. BecausefetchAtBuffer_
is false, we begin requesting segments from thecurrentTime
rather than the end of the buffer. This causes the playback watcher to assume a segment download has stalled, because when we request segments at thecurrentTime
we're either requesting cached segments or overwriting segments that were already buffered, which results in the buffer not changing and an increment of the stalled segment counter.Specific Changes proposed
Since this logic was originally implemented as an fix for LLHLS playback (see: #1201) we can isolate it to LLHLS streams by checking for a
partTargetDuration
on the playlist, which is required for LLHLS streams, see: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.7.This greatly reduces the re-requesting of already buffered and cached segment requests during live playback and in turn the stability of these streams as the buffer isn't being artificially starved during a rendition switch.
Requirements Checklist