TestSpeedProvider
@UnstableApi
public final class TestSpeedProvider implements SpeedProvider
SpeedProvider for tests
Summary
Public methods |
|
|---|---|
static TestSpeedProvider |
createWithFrameCounts(Creates a |
static TestSpeedProvider |
createWithStartTimes(long[] startTimesUs, float[] speeds)Creates a |
long |
getNextSpeedChangeTimeUs(long timeUs)Returns the timestamp of the next speed change, if there is any. |
float |
getSpeed(long timeUs)Returns the media speed from the provided timestamp. |
Inherited Constants |
||
|---|---|---|
|
Public methods
createWithFrameCounts
public static TestSpeedProvider createWithFrameCounts(
AudioProcessor.AudioFormat audioFormat,
int[] frameCounts,
float[] speeds
)
Creates a TestSpeedProvider instance.
| Parameters | |
|---|---|
AudioProcessor.AudioFormat audioFormat |
the |
int[] frameCounts |
The frame counts for which the same speed should be applied. |
float[] speeds |
The speeds corresponding to each frame count. Consecutive values must be distinct. |
| Returns | |
|---|---|
TestSpeedProvider |
A |
createWithStartTimes
public static TestSpeedProvider createWithStartTimes(long[] startTimesUs, float[] speeds)
Creates a TestSpeedProvider instance.
| Parameters | |
|---|---|
long[] startTimesUs |
The speed change start times, in microseconds. The values must be distinct and in increasing order. |
float[] speeds |
The speeds corresponding to each start time. Consecutive values must be distinct. |
| Returns | |
|---|---|
TestSpeedProvider |
A |
getNextSpeedChangeTimeUs
public long getNextSpeedChangeTimeUs(long timeUs)
Returns the timestamp of the next speed change, if there is any.
| Parameters | |
|---|---|
long timeUs |
A timestamp, in microseconds. |
| Returns | |
|---|---|
long |
The timestamp of the next speed change, in microseconds, or |
getSpeed
public float getSpeed(long timeUs)
Returns the media speed from the provided timestamp.
The media speed will stay the same until the next specified speed change.
| Parameters | |
|---|---|
long timeUs |
The timestamp of the media. |
| Returns | |
|---|---|
float |
The speed that the media should be played at. |