mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
package androidx.media3.exoplayer.upstream.experimental;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ExponentialWeightedAverageStatistic implements BandwidthStatistic {
|
|
public static final double DEFAULT_SMOOTHING_FACTOR = 0.9999d;
|
|
private long bitrateEstimate;
|
|
private final double smoothingFactor;
|
|
|
|
@Override // androidx.media3.exoplayer.upstream.experimental.BandwidthStatistic
|
|
public long getBandwidthEstimate() {
|
|
return this.bitrateEstimate;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.upstream.experimental.BandwidthStatistic
|
|
public void reset() {
|
|
this.bitrateEstimate = Long.MIN_VALUE;
|
|
}
|
|
|
|
public ExponentialWeightedAverageStatistic() {
|
|
this(0.9999d);
|
|
}
|
|
|
|
public ExponentialWeightedAverageStatistic(double d) {
|
|
this.smoothingFactor = d;
|
|
this.bitrateEstimate = Long.MIN_VALUE;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.upstream.experimental.BandwidthStatistic
|
|
public void addSample(long j, long j2) {
|
|
long j3 = (8000000 * j) / j2;
|
|
if (this.bitrateEstimate == Long.MIN_VALUE) {
|
|
this.bitrateEstimate = j3;
|
|
} else {
|
|
double pow = Math.pow(this.smoothingFactor, Math.sqrt(j));
|
|
this.bitrateEstimate = (long) ((this.bitrateEstimate * pow) + ((1.0d - pow) * j3));
|
|
}
|
|
}
|
|
}
|