Class: shaka.abr.EwmaBandwidthEstimator

This class tracks bandwidth samples and estimates available bandwidth. Based on the minimum of two exponentially-weighted moving averages with different half-lives.

Constructor

new EwmaBandwidthEstimator()

This class tracks bandwidth samples and estimates available bandwidth. Based on the minimum of two exponentially-weighted moving averages with different half-lives.

Source:

Members

bytesSampled_ :number

Number of bytes sampled.
Type:
  • number
Source:

fast_ :shaka.abr.Ewma

A fast-moving average. Half of the estimate is based on the last 2 seconds of sample history.
Type:
Source:

minBytes_ :number

Minimum number of bytes, under which samples are discarded. Our models do not include latency information, so connection startup time (time to first byte) is considered part of the download time. Because of this, we should ignore very small downloads which would cause our estimate to be too low. This specific value is based on experimentation.
Type:
  • number
Source:

minTotalBytes_ :number

Minimum number of bytes sampled before we trust the estimate. If we have not sampled much data, our estimate may not be accurate enough to trust. If bytesSampled_ is less than minTotalBytes_, we use defaultEstimate_. This specific value is based on experimentation.
Type:
  • number
Source:

slow_ :shaka.abr.Ewma

A slow-moving average. Half of the estimate is based on the last 5 seconds of sample history.
Type:
Source:

Methods

configure(config)

Called by the Player to provide an updated configuration any time it changes. Must be called at least once before init().
Parameters:
Name Type Description
config shaka.extern.AdvancedAbrConfiguration
Source:

getBandwidthEstimate(defaultEstimate) → {number}

Gets the current bandwidth estimate.
Parameters:
Name Type Description
defaultEstimate number
Source:
Returns:
The bandwidth estimate in bits per second.
Type
number

hasGoodEstimate() → {boolean}

Source:
Returns:
True if there is enough data to produce a meaningful estimate.
Type
boolean

sample(durationMs, numBytes)

Takes a bandwidth sample.
Parameters:
Name Type Description
durationMs number The amount of time, in milliseconds, for a particular request.
numBytes number The total number of bytes transferred in that request.
Source: