ConstantRateTimestampIterator


@UnstableApi
class ConstantRateTimestampIterator : TimestampIterator


A TimestampIterator that generates monotonically increasing timestamps (in microseconds) distributed evenly over the given durationUs based on the given frameRate.

Summary

Public constructors

ConstantRateTimestampIterator(
    durationUs: @IntRange(from = 1) Long,
    frameRate: @FloatRange(from = 0, fromInclusive = false) Float
)

Creates an instance that outputs timestamps from 0.

ConstantRateTimestampIterator(
    durationUs: @IntRange(from = 1) Long,
    frameRate: @FloatRange(from = 0, fromInclusive = false) Float,
    startingTimestampUs: @IntRange(from = 0) Long
)

Creates an instance that outputs timestamps from startingTimestampUs.

Public functions

ConstantRateTimestampIterator!

Returns fresh copy of the iterator.

Boolean

Returns whether there is another element.

Long

Returns the next timestamp.

Public constructors

ConstantRateTimestampIterator

ConstantRateTimestampIterator(
    durationUs: @IntRange(from = 1) Long,
    frameRate: @FloatRange(from = 0, fromInclusive = false) Float
)

Creates an instance that outputs timestamps from 0.

Parameters
durationUs: @IntRange(from = 1) Long

The duration the timestamps should span over, in microseconds.

frameRate: @FloatRange(from = 0, fromInclusive = false) Float

The frame rate in frames per second.

ConstantRateTimestampIterator

ConstantRateTimestampIterator(
    durationUs: @IntRange(from = 1) Long,
    frameRate: @FloatRange(from = 0, fromInclusive = false) Float,
    startingTimestampUs: @IntRange(from = 0) Long
)

Creates an instance that outputs timestamps from startingTimestampUs.

Parameters
durationUs: @IntRange(from = 1) Long

The duration the timestamps should span over, in microseconds.

frameRate: @FloatRange(from = 0, fromInclusive = false) Float

The frame rate in frames per second.

startingTimestampUs: @IntRange(from = 0) Long

The first timestamp output from the iterator.

Public functions

copyOf

fun copyOf(): ConstantRateTimestampIterator!

Returns fresh copy of the iterator.

hasNext

fun hasNext(): Boolean

Returns whether there is another element.

next

fun next(): Long

Returns the next timestamp.