@svta/common-media-library
Version:
A common library for media playback in JavaScript
24 lines • 568 B
JavaScript
import { getBandwidthBps } from '../utils/getBandwidthBps.js';
/**
* Arithmetic Mean throughput estimator
*
* @group Throughput
*
* @beta
*/
export class ArithmeticMeanEstimator {
constructor() {
this.samples = [];
}
sample(sample) {
this.samples.push(sample);
}
getEstimate() {
let value = 0;
for (let i = 0; i < this.samples.length; i++) {
value += getBandwidthBps(this.samples[i]);
}
return value / this.samples.length;
}
}
//# sourceMappingURL=ArithmeticMeanEstimator.js.map