Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Simplified fetch algorithm as much as possible #875

Merged
merged 1 commit into from
Nov 22, 2016
Merged

Conversation

imbcmdth
Copy link
Member

Description

Tore out the entire "fetch" algorithm and replaced it with something simpler and more robust (hopefully!) The process resulted in a lot of changes and the introduction of a "sync-point" mechanism. A "sync-point" is defined as a known mapping between display-time and a segment index that can be used to make a reasonable and conservative guess about what segment to load next. (It's conservative in that it always errors on the side of guessing too "early".)

Internally, we keep track of many potential sync-points and attempt the pick the one that will give us the most accurate guesses when ever we need to make a guess. Guessing is rare though and a major of the fetch-logic devolves into a simple walk forward through the playlist (mediaIndex++).

} else if (media &&
// 2) the video is a VOD
media.endList) {
this.hasPlayed_ = () => this.tech_.played().length !== 0;
Copy link
Member Author

@imbcmdth imbcmdth Oct 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to rethink hasPlayed_ soon... it is complicated to get this working in all 4 cases:

  • MSE & VOD
  • MSE & Live
  • Flash & VOD
  • Flash & Live

To get halfway to a proper fix may require first fixing the tech's played function (especially in the flash case).

}).filter(s => s.timeline === this.currentTimeline_);

if (segmentIndexArray.length) {
return segmentIndexArray[Math.min(segmentIndexArray.length - 1, 1)].segmentIndex;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like if there is only one segment with the current timeline, we pick that, otherwise pick the second of the list. Why are these options better candidates than any of the other segments?

@imbcmdth imbcmdth force-pushed the simple-fetcher branch 3 times, most recently from 804e227 to ab27809 Compare November 18, 2016 22:22
Fixed seeking behavior

Updated getMediaIndexForTime to be simple and stupid

Remove spurious console logs

Fixed an issue with forward seeks and a different problem with backwards seeking (thanks Matt!). Fixed fast rendition change behavior.

Remove limits on gap-skipper. Skip instantly without waiting.

Use the proper native MediaSource duration for buffer removals.

Improvements for live stream rendition changes

Fixed an undefined variable bug

Some more simplification and a very conservative live stream rendition change approach

VOD fixes

Experimental change to the way we throttle the fetcher

Use GOAL_BUFFER_LENGTH again

Continued massive changes to segment fetching. Cleanup and comments.

Fixed a bug where we were fetching starting at mediaIndex 0 on every seek.

Refactor probing code in preparation for pulling into it's own module or class

Moved sync-related logic out of segment-loader and into a new sync-controller class

Removed expired from the SegmentLoader

Update mux.js dependency to 2.5.0

Don't error when the tsprobe returns null

Fixed two issues: MAAT switching and Flash seeking

Rename duration variable

fix flash failing first segment load (#859)

dont use tech for has played (#861)

Code Coverage and Unit tests for Simple Fetcher (#862)

fix has played returning false on vod (#866)

Fixed preload="none" behavior and reduced the incidence of repeating initial segment requests (#878)

Provide option to set contrib-hls first in the HTML5 tech (#889)

This reverts commit 59ddbe1.

Add playback tests (#894)

Fixed MSE and environment test helpers, restore properly

Removed unused test files

remove expired time tracking and use sync points to calculate seekable (#898)

Fixing a few tests for QUnit 2.0
@imbcmdth imbcmdth merged commit e484875 into master Nov 22, 2016
@forbesjo forbesjo deleted the simple-fetcher branch July 13, 2017 19:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants