Repository navigation
Conversation
…ed an offset mergeDetails had already applied
Collaborator
|
This appears to duplicate #8170 for which I left the following comment #8170 (comment) Playlists should not be adjusted twice. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR will...
Make
adjustSliding()shift a playlist relative to where its fragments already start, instead of adding an absolute offset.Why is this Pull Request needed?
adjustSliding()assumesnewDetailsis freshly parsed, with its first fragment at 0. On an alternate audio refresh it can run twice, and the second call adds the offset again.mergeDetails(). No overlapping fragment hasstartPTS, so it places the new playlist withadjustSliding(oldDetails, newDetails). The position is correct, butalignedSlidingstaysfalse.onAudioTrackLoaded()sees!alignedSlidingand callsalignStream(mainDetails, newDetails). Neither discontinuity nor PDT alignment applies, so it reachesadjustSliding(mainDetails, newDetails, false). Whendelta >= 0, that addsmainDetails.fragments[delta].startto fragments that are already at that start.Log from a stalled run:
The audio playlist then starts around 152 s while the playhead is around 86 s, so audio never loads again. Each later refresh repeats it (
diff: 78.03,82.03, ...). The media element stays atreadyState1 with video buffered ahead. No error is raised and nowaitingevent fires after resume, so nothing recovers.During normal playback the overlap usually carries PTS,
mergeDetails()setsalignedSliding, and step 3 is skipped. That is why it takes a pause or stall longer than the window.Reproduced on a Cloudflare Stream live channel (2 s segments, 8-segment window, alternate audio) in iPhone Safari with ManagedMediaSource. It depends on which playlist refreshed last, so it is intermittent: 2 of 4 paused runs stalled. With this change 4 of 4 played on, and in the two runs that hit this path the realignment moved audio by 0.02 s instead of 76 s.
Are there any points in the code the reviewer needs to double check?
For freshly parsed details
fragments[skippedSegments].startis 0, so existing callers compute the same offset as before. Only details that were already placed change, and they now get a near-zero correction. The last branch (fragmentStart === 0) is unchanged.Alternatives I considered: set
alignedSlidinginmergeDetails()when itsadjustSliding()call placed the playlist, or skipalignStream(mainDetails, ...)in the audio and subtitle controllers after a merge. Both would also skip discontinuity and PDT alignment against main on that refresh, which seemed riskier than making the helper safe to call twice. Happy to switch if you prefer one of those.Resolves issues:
None filed.
Checklist
tests/unit/controller/level-helper.ts. It fails on master with[10, 15, 20]instead of[5, 10, 15].