docs/doc/reference/com/google/android/exoplayer2/util/TimestampAdjuster.html
Package com.google.android.exoplayer2.util
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classTimestampAdjusterextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Adjusts and offsets sample timestamps. MPEG-2 TS timestamps scaling and adjustment is supported, taking into account timestamp rollover.
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static long | MODE_NO_OFFSET |
Deprecated.
A special firstSampleTimestampUs value indicating that presentation timestamps should not be offset.
|
| static long | MODE_SHARED |
Deprecated.
A special firstSampleTimestampUs value indicating that the adjuster will be shared by multiple threads.
|
Constructors | Constructor | Description |
| --- | --- |
| TimestampAdjuster(long firstSampleTimestampUs) |
Deprecated.
|
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| long | adjustSampleTimestamp(long timeUs) |
Deprecated.
Offsets a timestamp in microseconds.
|
| long | adjustTsTimestamp(long pts90Khz) |
Deprecated.
Scales and offsets an MPEG-2 TS presentation timestamp considering wraparound.
|
| long | getFirstSampleTimestampUs() |
Deprecated.
Returns the value of the first adjusted sample timestamp in microseconds, or C.TIME_UNSET if timestamps will not be offset or if the adjuster is in shared mode.
|
| long | getLastAdjustedTimestampUs() |
Deprecated.
Returns the last adjusted timestamp, in microseconds.
|
| long | getTimestampOffsetUs() |
Deprecated.
Returns the offset between the input of adjustSampleTimestamp(long) and its output, or C.TIME_UNSET if the offset has not yet been determined.
|
| boolean | isInitialized() |
Deprecated.
Returns whether the instance is initialized with a timestamp offset.
|
| static long | ptsToUs(long pts) |
Deprecated.
Converts a 90 kHz clock timestamp to a timestamp in microseconds.
|
| void | reset(long firstSampleTimestampUs) |
Deprecated.
Resets the instance.
|
| void | sharedInitializeOrWait(boolean canInitialize, long nextSampleTimestampUs, long timeoutMs) |
Deprecated.
For shared timestamp adjusters, performs necessary initialization actions for a caller.
|
| static long | usToNonWrappedPts(long us) |
Deprecated.
Converts a timestamp in microseconds to a 90 kHz clock timestamp.
|
| static long | usToWrappedPts(long us) |
Deprecated.
Converts a timestamp in microseconds to a 90 kHz clock timestamp, performing wraparound to keep the result within 33-bits. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final long MODE_NO_OFFSET
Deprecated.
A special firstSampleTimestampUs value indicating that presentation timestamps should not be offset. In this mode:
- getFirstSampleTimestampUs() will always return C.TIME_UNSET.
- The only timestamp adjustment performed is to account for MPEG-2 TS timestamp rollover.
See Also:Constant Field Values
-
public static final long MODE_SHARED
Deprecated.
A special firstSampleTimestampUs value indicating that the adjuster will be shared by multiple threads. In this mode:
- getFirstSampleTimestampUs() will always return C.TIME_UNSET.
- Calling threads must call sharedInitializeOrWait(boolean, long, long) prior to adjusting timestamps.
See Also:Constant Field Values
-
public TimestampAdjuster(long firstSampleTimestampUs)
Deprecated.
Parameters:firstSampleTimestampUs - The desired value of the first adjusted sample timestamp in microseconds, or MODE_NO_OFFSET if timestamps should not be offset, or MODE_SHARED if the adjuster will be used in shared mode.
-
public void sharedInitializeOrWait(boolean canInitialize,
long nextSampleTimestampUs,
long timeoutMs)
throws[InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException.html "class or interface in java.lang"),[TimeoutException](https://developer.android.com/reference/java/util/concurrent/TimeoutException.html "class or interface in java.util.concurrent")
Deprecated.
For shared timestamp adjusters, performs necessary initialization actions for a caller.
- If the adjuster has already established a timestamp offset then this method is a no-op.
- If canInitialize is true and the adjuster has not yet established a timestamp offset, then the adjuster records the desired first sample timestamp for the calling thread and returns to allow the caller to proceed. If the timestamp offset has still not been established when the caller attempts to adjust its first timestamp, then the recorded timestamp is used to set it.
- If canInitialize is false and the adjuster has not yet established a timestamp offset, then the call blocks until the timestamp offset is set.
Parameters:canInitialize - Whether the caller is able to initialize the adjuster, if needed.nextSampleTimestampUs - The desired timestamp for the next sample loaded by the calling thread, in microseconds. Only used if canInitialize is true.timeoutMs - The timeout for the thread to wait for the timestamp adjuster to initialize, in milliseconds. A timeout of zero is interpreted as an infinite timeout.Throws:InterruptedException - If the thread is interrupted whilst blocked waiting for initialization to complete.TimeoutException - If the thread is timeout whilst blocked waiting for initialization to complete.
-
public long getFirstSampleTimestampUs()
Deprecated.
Returns the value of the first adjusted sample timestamp in microseconds, or C.TIME_UNSET if timestamps will not be offset or if the adjuster is in shared mode.
-
public long getLastAdjustedTimestampUs()
Deprecated.
Returns the last adjusted timestamp, in microseconds. If no timestamps have been adjusted yet then the result of getFirstSampleTimestampUs() is returned.
-
public long getTimestampOffsetUs()
Deprecated.
Returns the offset between the input of adjustSampleTimestamp(long) and its output, or C.TIME_UNSET if the offset has not yet been determined.
-
public void reset(long firstSampleTimestampUs)
Deprecated.
Resets the instance.
Parameters:firstSampleTimestampUs - The desired value of the first adjusted sample timestamp after this reset in microseconds, or MODE_NO_OFFSET if timestamps should not be offset, or MODE_SHARED if the adjuster will be used in shared mode.
-
public long adjustTsTimestamp(long pts90Khz)
Deprecated.
Scales and offsets an MPEG-2 TS presentation timestamp considering wraparound.
Parameters:pts90Khz - A 90 kHz clock MPEG-2 TS presentation timestamp.Returns:The adjusted timestamp in microseconds.
-
public long adjustSampleTimestamp(long timeUs)
Deprecated.
Offsets a timestamp in microseconds.
Parameters:timeUs - The timestamp to adjust in microseconds.Returns:The adjusted timestamp in microseconds.
-
public boolean isInitialized()
Deprecated.
Returns whether the instance is initialized with a timestamp offset.
-
public static long ptsToUs(long pts)
Deprecated.
Converts a 90 kHz clock timestamp to a timestamp in microseconds.
Parameters:pts - A 90 kHz clock timestamp.Returns:The corresponding value in microseconds.
-
public static long usToWrappedPts(long us)
Deprecated.
Converts a timestamp in microseconds to a 90 kHz clock timestamp, performing wraparound to keep the result within 33-bits.
Parameters:us - A value in microseconds.Returns:The corresponding value as a 90 kHz clock timestamp, wrapped to 33 bits.
-
public static long usToNonWrappedPts(long us)
Deprecated.
Converts a timestamp in microseconds to a 90 kHz clock timestamp.
Does not perform any wraparound. To get a 90 kHz timestamp suitable for use with MPEG-TS, use usToWrappedPts(long).
Parameters:us - A value in microseconds.Returns:The corresponding value as a 90 kHz clock timestamp.