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

Create a moving-average playlist selector #1125

Merged
merged 5 commits into from
May 30, 2017
Merged

Conversation

dmlap
Copy link
Member

@dmlap dmlap commented May 22, 2017

Description

  • Define a variant of the standard playlist selector that calculates a moving average of bandwidth and uses that to select a playlist.
  • Pull the basic playlist selector into a separate file so there's a shared place to build alternates.

dmlap added 2 commits May 19, 2017 19:01
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.
{ attributes: { BANDWIDTH: 100 } }
];
hls.systemBandwidth = 50 * Config.BANDWIDTH_VARIANCE + 1;
playlist = instantAverage.bind(hls)();
Copy link
Contributor

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?

playlist = fiftyPercentDecay.bind(hls)();
assert.equal(playlist.attributes.BANDWIDTH, 100, 'selected the top playlist');

// bandwidth = 0.5 * systemBandwidth + 0.5 * (100 * variance + 1)
Copy link
Contributor

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

return simpleSelector(this.playlists.master,
average,
parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10),
parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10));
Copy link
Contributor

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

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.

3 participants