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(Creates an instance that outputs timestamps from |
ConstantRateTimestampIterator(Creates an instance that outputs timestamps from |
Public methods |
|
|---|---|
ConstantRateTimestampIterator |
copyOf()Returns fresh copy of the iterator. |
long |
Returns the last (final) timestamp this iterator generates, in microseconds. |
boolean |
hasNext()Returns whether there is another element. |
long |
next()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 = 0) long startPositionUs,
@IntRange(from = 1) long endPositionUs,
@FloatRange(from = 0, fromInclusive = false) float frameRate
)
Creates an instance that outputs timestamps from startTimeUs.
| Parameters | |
|---|---|
@IntRange(from = 0) long startPositionUs |
The start position in microseconds. The first timestamp generated will be equal to |
@IntRange(from = 1) long endPositionUs |
The end position at which the timestamps finish, in microseconds. The generated timestamps are less or equal to the end position. |
@FloatRange(from = 0, fromInclusive = false) float frameRate |
The frame rate in frames per second. |
Public methods
getLastTimestampUs
public long getLastTimestampUs()
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.