TestSpeedProvider


@UnstableApi
class TestSpeedProvider : SpeedProvider


SpeedProvider for tests

Summary

Public functions

java-static TestSpeedProvider!
createWithFrameCounts(
    audioFormat: AudioProcessor.AudioFormat!,
    frameCounts: IntArray!,
    speeds: FloatArray!
)

Creates a TestSpeedProvider instance.

java-static TestSpeedProvider!
createWithStartTimes(startTimesUs: LongArray!, speeds: FloatArray!)

Creates a TestSpeedProvider instance.

Long

Returns the timestamp of the next speed change, if there is any.

Float
getSpeed(timeUs: Long)

Returns the media speed from the provided timestamp.

Public functions

createWithFrameCounts

java-static fun createWithFrameCounts(
    audioFormat: AudioProcessor.AudioFormat!,
    frameCounts: IntArray!,
    speeds: FloatArray!
): TestSpeedProvider!

Creates a TestSpeedProvider instance.

Parameters
audioFormat: AudioProcessor.AudioFormat!

the AudioFormat.

frameCounts: IntArray!

The frame counts for which the same speed should be applied.

speeds: FloatArray!

The speeds corresponding to each frame count. Consecutive values must be distinct.

Returns
TestSpeedProvider!

A TestSpeedProvider.

createWithStartTimes

java-static fun createWithStartTimes(startTimesUs: LongArray!, speeds: FloatArray!): TestSpeedProvider!

Creates a TestSpeedProvider instance.

Parameters
startTimesUs: LongArray!

The speed change start times, in microseconds. The values must be distinct and in increasing order.

speeds: FloatArray!

The speeds corresponding to each start time. Consecutive values must be distinct.

Returns
TestSpeedProvider!

A TestSpeedProvider.

getNextSpeedChangeTimeUs

fun getNextSpeedChangeTimeUs(timeUs: Long): Long

Returns the timestamp of the next speed change, if there is any.

Parameters
timeUs: Long

A timestamp, in microseconds.

Returns
Long

The timestamp of the next speed change, in microseconds, or TIME_UNSET if there is no next speed change. If timeUs corresponds to a speed change, the returned value corresponds to the following speed change.

getSpeed

fun getSpeed(timeUs: Long): Float

Returns the media speed from the provided timestamp.

The media speed will stay the same until the next specified speed change.

Parameters
timeUs: Long

The timestamp of the media.

Returns
Float

The speed that the media should be played at.