ConstantRateTimestampIterator


@UnstableApi
public final class ConstantRateTimestampIterator implements 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(
    @IntRange(from = 1) long durationUs,
    @FloatRange(from = 0, fromInclusive = false) float frameRate
)

Creates an instance that outputs timestamps from 0.

ConstantRateTimestampIterator(
    @IntRange(from = 1) long durationUs,
    @FloatRange(from = 0, fromInclusive = false) float frameRate,
    @IntRange(from = 0) long startingTimestampUs
)

Creates an instance that outputs timestamps from startingTimestampUs.

Public methods

ConstantRateTimestampIterator

Returns fresh copy of the iterator.

boolean

Returns whether there is another element.

long

Returns the next timestamp.

Public constructors

ConstantRateTimestampIterator

public ConstantRateTimestampIterator(
    @IntRange(from = 1) long durationUs,
    @FloatRange(from = 0, fromInclusive = false) float frameRate
)

Creates an instance that outputs timestamps from 0.

Parameters
@IntRange(from = 1) long durationUs

The duration the timestamps should span over, in microseconds.

@FloatRange(from = 0, fromInclusive = false) float frameRate

The frame rate in frames per second.

ConstantRateTimestampIterator

public ConstantRateTimestampIterator(
    @IntRange(from = 1) long durationUs,
    @FloatRange(from = 0, fromInclusive = false) float frameRate,
    @IntRange(from = 0) long startingTimestampUs
)

Creates an instance that outputs timestamps from startingTimestampUs.

Parameters
@IntRange(from = 1) long durationUs

The duration the timestamps should span over, in microseconds.

@FloatRange(from = 0, fromInclusive = false) float frameRate

The frame rate in frames per second.

@IntRange(from = 0) long startingTimestampUs

The first timestamp output from the iterator.

Public methods

copyOf

public ConstantRateTimestampIterator copyOf()

Returns fresh copy of the iterator.

hasNext

public boolean hasNext()

Returns whether there is another element.

next

public long next()

Returns the next timestamp.