Class: shaka.abr.EwmaBandwidthEstimator

Constructor

new EwmaBandwidthEstimator()

Tracks bandwidth samples and estimates available bandwidth. Based on the minimum of two exponentially-weighted moving averages with different half-lives.
Source:

Members

(static, constant) DEFAULT_ESTIMATE :number

Contains the default estimate to use when there is not enough data.
Type:
  • number
Source:

(private) defaultEstimate_ :number

Initial estimate used when there is not enough data.
Type:
  • number
Source:

(private, non-null) fast_ :shaka.abr.Ewma

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

(private, constant) minBytes_ :number

Minimum number of bytes, under which samples are discarded.
Type:
  • number
Source:

(private, constant) minDelayMs_ :number

Prevents ultra-fast internal connections from causing crazy results.
Type:
  • number
Source:

(private, constant) minTime_ :number

Minimum amount of time (in ms), under which samples are discarded.
Type:
  • number
Source:

(private, constant) minWeight_ :number

Minimum weight required to trust the estimate.
Type:
  • number
Source:

(private, non-null) slow_ :shaka.abr.Ewma

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

Methods

getBandwidthEstimate() → {number}

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

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:

setDefaultEstimate(estimate)

Sets the default bandwidth estimate to use if there is not enough data.
Parameters:
Name Type Description
estimate number The default bandwidth estimate, in bit/sec.
Source: