This repository has been archived by the owner on Jan 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 795
Create a moving-average playlist selector #1125
Merged
Merged
Conversation
This file contains 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
Pull the basic playlist selector into a separate file so there's a shared place to build alternates.
Define a variant of the standard playlist selector that calculates a moving average of bandwidth and uses that to select a playlist.
gesinger
approved these changes
May 25, 2017
test/playlist-selectors.test.js
Outdated
{ attributes: { BANDWIDTH: 100 } } | ||
]; | ||
hls.systemBandwidth = 50 * Config.BANDWIDTH_VARIANCE + 1; | ||
playlist = instantAverage.bind(hls)(); |
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.
Not a big deal, but any reason you chose bind
instead of call
?
test/playlist-selectors.test.js
Outdated
playlist = fiftyPercentDecay.bind(hls)(); | ||
assert.equal(playlist.attributes.BANDWIDTH, 100, 'selected the top playlist'); | ||
|
||
// bandwidth = 0.5 * systemBandwidth + 0.5 * (100 * variance + 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.
Minor, but might be worth adding average = decay * systemBandwidth + (1 - decay) * average
above
mjneil
reviewed
May 26, 2017
return simpleSelector(this.playlists.master, | ||
average, | ||
parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10), | ||
parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10)); |
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 it would be a good idea to make movingAverageBandwidthSelector
and lastBandwidthSelector
not rely on this
Change binds in moving average test to calls
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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