docs/doc/reference/com/google/android/exoplayer2/upstream/experimental/SlidingWeightedAverageBandwidthStatistic.html
Package com.google.android.exoplayer2.upstream.experimental
All Implemented Interfaces:BandwidthStatistic
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public classSlidingWeightedAverageBandwidthStatisticextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[BandwidthStatistic](BandwidthStatistic.html "interface in com.google.android.exoplayer2.upstream.experimental")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
A BandwidthStatistic that calculates estimates based on a sliding window weighted average.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static class | SlidingWeightedAverageBandwidthStatistic.Sample |
Deprecated.
Represents a bandwidth sample.
|
| static interface | SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction |
Deprecated.
An interface to decide if samples need to be evicted from the estimator. |
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int | DEFAULT_MAX_SAMPLES_COUNT |
Deprecated.
The default maximum number of samples. |
Constructors | Constructor | Description |
| --- | --- |
| SlidingWeightedAverageBandwidthStatistic() |
Deprecated.
Creates an instance that keeps up to DEFAULT_MAX_SAMPLES_COUNT samples.
|
| SlidingWeightedAverageBandwidthStatistic(SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction sampleEvictionFunction) |
Deprecated.
Creates an instance. |
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | addSample(long bytes, long durationUs) |
Deprecated.
Adds a transfer sample to the statistic.
|
| static SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction | getAgeBasedEvictionFunction(long maxAgeMs) |
Deprecated.
Gets a SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction that maintains samples up to maxAgeMs.
|
| long | getBandwidthEstimate() |
Deprecated.
Returns the bandwidth estimate in bits per second, or BandwidthEstimator.ESTIMATE_NOT_AVAILABLE if there is no estimate available yet.
|
| static SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction | getMaxCountEvictionFunction(long maxSamplesCount) |
Deprecated.
Gets a SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction that maintains up to maxSamplesCount samples.
|
| void | reset() |
Deprecated.
Resets the statistic. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int DEFAULT_MAX_SAMPLES_COUNT
Deprecated.
The default maximum number of samples. See Also:Constant Field Values
-
public SlidingWeightedAverageBandwidthStatistic()
Deprecated.
Creates an instance that keeps up to DEFAULT_MAX_SAMPLES_COUNT samples.
-
public SlidingWeightedAverageBandwidthStatistic([SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction](SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction.html "interface in com.google.android.exoplayer2.upstream.experimental")sampleEvictionFunction)
Deprecated.
Creates an instance.
Parameters:sampleEvictionFunction - The SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction deciding whether to drop samples when new samples are added.
-
public static[SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction](SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction.html "interface in com.google.android.exoplayer2.upstream.experimental")getMaxCountEvictionFunction(long maxSamplesCount)
Deprecated.
Gets a SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction that maintains up to maxSamplesCount samples.
-
public static[SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction](SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction.html "interface in com.google.android.exoplayer2.upstream.experimental")getAgeBasedEvictionFunction(long maxAgeMs)
Deprecated.
Gets a SlidingWeightedAverageBandwidthStatistic.SampleEvictionFunction that maintains samples up to maxAgeMs.
-
public void addSample(long bytes,
long durationUs)
Deprecated.
Description copied from interface: BandwidthStatistic
Adds a transfer sample to the statistic.
Specified by:addSample in interface BandwidthStatisticParameters:bytes - The number of bytes transferred.durationUs - The duration of the transfer, in microseconds.
-
public long getBandwidthEstimate()
Deprecated.
Description copied from interface: BandwidthStatistic
Returns the bandwidth estimate in bits per second, or BandwidthEstimator.ESTIMATE_NOT_AVAILABLE if there is no estimate available yet.
Specified by:getBandwidthEstimate in interface BandwidthStatistic
-
public void reset()
Deprecated.
Description copied from interface: BandwidthStatistic
Resets the statistic. The statistic should drop all samples and reset to its initial state, similar to right after construction.
Specified by:reset in interface BandwidthStatistic