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(
    startPositionUs: @IntRange(from = 0) Long,
    endPositionUs: @IntRange(from = 1) Long,
    frameRate: @FloatRange(from = 0, fromInclusive = false) Float
)

Creates an instance that outputs timestamps from startTimeUs.

Public functions

ConstantRateTimestampIterator!

Returns fresh copy of the iterator.

Long

Returns the last (final) timestamp this iterator generates, in microseconds.

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(
    startPositionUs: @IntRange(from = 0) Long,
    endPositionUs: @IntRange(from = 1) Long,
    frameRate: @FloatRange(from = 0, fromInclusive = false) Float
)

Creates an instance that outputs timestamps from startTimeUs.

Parameters
startPositionUs: @IntRange(from = 0) Long

The start position in microseconds. The first timestamp generated will be equal to startPositionUs.

endPositionUs: @IntRange(from = 1) Long

The end position at which the timestamps finish, in microseconds. The generated timestamps are less or equal to the end position.

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

The frame rate in frames per second.

Public functions

copyOf

fun copyOf(): ConstantRateTimestampIterator!

Returns fresh copy of the iterator.

getLastTimestampUs

fun getLastTimestampUs(): Long

Returns the last (final) timestamp this iterator generates, in microseconds.

This method returns TIME_UNSET if the last timestamp is unknown, or when no timestamp will be generated.

hasNext

fun hasNext(): Boolean

Returns whether there is another element.

next

fun next(): Long

Returns the next timestamp.