Constructor
new EwmaBandwidthEstimator()
Tracks bandwidth samples and estimates available bandwidth.
Based on the minimum of two exponentially-weighted moving averages with
different half-lives.
Members
-
(static, constant) DEFAULT_ESTIMATE :number
-
Contains the default estimate to use when there is not enough data.
Type:
- number
-
(private) defaultEstimate_ :number
-
Initial estimate used when there is not enough data.
Type:
- number
-
(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:
-
(private, constant) minBytes_ :number
-
Minimum number of bytes, under which samples are discarded.
Type:
- number
-
(private, constant) minDelayMs_ :number
-
Prevents ultra-fast internal connections from causing crazy results.
Type:
- number
-
(private, constant) minTime_ :number
-
Minimum amount of time (in ms), under which samples are discarded.
Type:
- number
-
(private, constant) minWeight_ :number
-
Minimum weight required to trust the estimate.
Type:
- number
-
(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:
Methods
-
getBandwidthEstimate() → {number}
-
Gets the current bandwidth estimate.
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. -
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.