SpeedProviderUtil
@UnstableApi
public class SpeedProviderUtil
Utilities for SpeedProvider.
Summary
Public methods |
|
|---|---|
static long |
getDurationAfterSpeedProviderApplied(Returns the duration of the output when the given |
static long |
getNextSpeedChangeSamplePosition(Returns the sample position of the next speed change or |
static float |
getSampleAlignedSpeed(Returns the speed at the specified sample position. |
Public methods
getDurationAfterSpeedProviderApplied
public static long getDurationAfterSpeedProviderApplied(
SpeedProvider speedProvider,
long durationUs
)
Returns the duration of the output when the given SpeedProvider is applied given an input stream with the given durationUs.
getNextSpeedChangeSamplePosition
public static long getNextSpeedChangeSamplePosition(
SpeedProvider speedProvider,
long samplePosition,
int sampleRate
)
Returns the sample position of the next speed change or INDEX_UNSET if none is set.
If the next speed change falls between sample boundaries, this method will return the next closest sample position, which ensures that speed regions stay consistent with getSampleAlignedSpeed.
getSampleAlignedSpeed
public static float getSampleAlignedSpeed(
SpeedProvider speedProvider,
long samplePosition,
int sampleRate
)
Returns the speed at the specified sample position.
This method is consistent with the alignment done by getNextSpeedChangeSamplePosition.