UNPKG

@svta/common-media-library

Version:
28 lines 763 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HarmonicMeanEstimator = void 0; const getBandwidthBps_js_1 = require("../utils/getBandwidthBps.js"); /** * Harmonic Mean throughput estimator * * @group Throughput * * @beta */ class HarmonicMeanEstimator { constructor() { this.samples = []; } sample(sample) { this.samples.push(sample); } getEstimate() { let value = 0; for (let i = 0; i < this.samples.length; i++) { value += 1 / (0, getBandwidthBps_js_1.getBandwidthBps)(this.samples[i]); } return this.samples.length / value; } } exports.HarmonicMeanEstimator = HarmonicMeanEstimator; //# sourceMappingURL=HarmonicMeanEstimator.js.map