Back to Exoplayer

SlidingPercentile (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/SlidingPercentile.html

latest3.4 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class SlidingPercentile


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public classSlidingPercentileextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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.

Calculate any percentile over a sliding window of weighted values. A maximum weight is configured. Once the total weight of the values reaches the maximum weight, the oldest value is reduced in weight until it reaches zero and is removed. This maintains a constant total weight, equal to the maximum allowed, at the steady state.

This class can be used for bandwidth estimation based on a sliding window of past transfer rate observations. This is an alternative to sliding mean and exponential averaging which suffer from susceptibility to outliers and slow adaptation to step functions.

See the following Wikipedia articles:

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | SlidingPercentile​(int maxWeight) | Deprecated. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | addSample​(int weight, float value) | Deprecated.

Adds a new weighted value. | | float | getPercentile​(float percentile) | Deprecated.

Computes a percentile by integration. | | void | reset() | Deprecated.

Resets the sliding percentile. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

SlidingPercentile

public SlidingPercentile​(int maxWeight)

Deprecated. Parameters:maxWeight - The maximum weight.

Method Detail

- 

reset

public void reset()

Deprecated.

Resets the sliding percentile.

- 

addSample

public void addSample​(int weight,
                      float value)

Deprecated.

Adds a new weighted value. Parameters:weight - The weight of the new observation.value - The value of the new observation.

- 

getPercentile

public float getPercentile​(float percentile)

Deprecated.

Computes a percentile by integration. Parameters:percentile - The desired percentile, expressed as a fraction in the range (0,1].Returns:The requested percentile value or Float.NaN if no samples have been added.