# FixedFrameRateEstimator

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/video/FixedFrameRateEstimator.java+class:androidx.media3.exoplayer.video.FixedFrameRateEstimator)

*** ** * ** ***


```
@UnstableApi
class FixedFrameRateEstimator
```

<br />

*** ** * ** ***

Attempts to detect and refine a fixed frame rate estimate based on frame presentation timestamps.

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator.Listener` A listener for frame rate estimate updates. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#CONSECUTIVE_MATCHING_FRAME_DURATIONS_FOR_SYNC() = 15` The number of consecutive matching frame durations required to detect a fixed frame rate. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#FixedFrameRateEstimator(androidx.media3.exoplayer.video.FixedFrameRateEstimator.Listener)(listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator.Listener!)` Creates a new estimator. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#getFrameDurationNs()()` The currently detected fixed frame duration estimate in nanoseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the estimator has not detected a fixed frame rate. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#onFormatChanged(float)(formatFrameRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Called when the output format changes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#onNextFrame(long)(framePresentationTimeNs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Called with each frame presentation timestamp. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#frameIndex()` |

## Constants

### CONSECUTIVE_MATCHING_FRAME_DURATIONS_FOR_SYNC

```
const val CONSECUTIVE_MATCHING_FRAME_DURATIONS_FOR_SYNC = 15: Int
```

The number of consecutive matching frame durations required to detect a fixed frame rate.

## Public constructors

### FixedFrameRateEstimator

```
FixedFrameRateEstimator(listener: FixedFrameRateEstimator.Listener!)
```

Creates a new estimator.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator.Listener!` | The listener to notify when the frame rate estimate changes. |

## Public functions

### getFrameDurationNs

```
fun getFrameDurationNs(): Long
```

The currently detected fixed frame duration estimate in nanoseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the estimator has not detected a fixed frame rate. Whilst synced, the estimate is refined each time `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/video/FixedFrameRateEstimator#onNextFrame(long)` is called with a new frame presentation timestamp.

### onFormatChanged

```
fun onFormatChanged(formatFrameRate: Float): Unit
```

Called when the output format changes.

| Parameters |
|---|---|
| `formatFrameRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The format's frame rate, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if unknown. |

### onNextFrame

```
fun onNextFrame(framePresentationTimeNs: Long): Unit
```

Called with each frame presentation timestamp.

| Parameters |
|---|---|
| `framePresentationTimeNs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The frame presentation timestamp, in nanoseconds. |

## Public properties

### frameIndex

```
val frameIndex: Long
```