FixedFrameRateEstimator


@UnstableApi
class FixedFrameRateEstimator


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

Summary

Nested types

A listener for frame rate estimate updates.

Constants

const Int

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

Public constructors

Creates a new estimator.

Public functions

Long

The currently detected fixed frame duration estimate in nanoseconds, or TIME_UNSET if the estimator has not detected a fixed frame rate.

Unit
onFormatChanged(formatFrameRate: Float)

Called when the output format changes.

Unit
onNextFrame(framePresentationTimeNs: Long)

Called with each frame presentation timestamp.

Public properties

Long

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: 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 TIME_UNSET if the estimator has not detected a fixed frame rate. Whilst synced, the estimate is refined each time onNextFrame is called with a new frame presentation timestamp.

onFormatChanged

fun onFormatChanged(formatFrameRate: Float): Unit

Called when the output format changes.

Parameters
formatFrameRate: Float

The format's frame rate, or NO_VALUE if unknown.

onNextFrame

fun onNextFrame(framePresentationTimeNs: Long): Unit

Called with each frame presentation timestamp.

Parameters
framePresentationTimeNs: Long

The frame presentation timestamp, in nanoseconds.

Public properties

frameIndex

val frameIndexLong