UNPKG

@svta/common-media-library

Version:
24 lines 566 B
import { getBandwidthBps } from '../utils/getBandwidthBps.js'; /** * Harmonic Mean throughput estimator * * @group Throughput * * @beta */ export 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 / getBandwidthBps(this.samples[i]); } return this.samples.length / value; } } //# sourceMappingURL=HarmonicMeanEstimator.js.map