MediaTimestamp
public
final
class
MediaTimestamp
extends Object
java.lang.Object | |
↳ | android.media.MediaTimestamp |
An immutable object that represents the linear correlation between the media time and the system time. It contains the media clock rate, together with the media timestamp of an anchor frame and the system time when that frame was presented or is committed to be presented.
The phrase "present" means that audio/video produced on device is detectable by an external observer off device. The time is based on the implementation's best effort, using whatever knowledge is available to the system, but cannot account for any delay unknown to the implementation. The anchor frame could be any frame, including a just-rendered frame, or even a theoretical or in-between frame, based on the source of the MediaTimestamp. When the anchor frame is a just-rendered one, the media time stands for current position of the playback or recording.
Summary
Fields | |
---|---|
public
static
final
MediaTimestamp |
TIMESTAMP_UNKNOWN
An unknown media timestamp value |
Public constructors | |
---|---|
MediaTimestamp(long mediaTimeUs, long nanoTimeNs, float clockRate)
Constructor. |
Public methods | |
---|---|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
long
|
getAnchorMediaTimeUs()
Get the media time of the anchor in microseconds. |
long
|
getAnchorSystemNanoTime()
Get the |
long
|
getAnchorSytemNanoTime()
This method was deprecated
in API level 29.
use |
float
|
getMediaClockRate()
Get the rate of the media clock in relation to the system time. |
String
|
toString()
Returns a string representation of the object. |
Inherited methods | |
---|---|
Fields
TIMESTAMP_UNKNOWN
public static final MediaTimestamp TIMESTAMP_UNKNOWN
An unknown media timestamp value
Public constructors
MediaTimestamp
public MediaTimestamp (long mediaTimeUs, long nanoTimeNs, float clockRate)
Constructor.
Parameters | |
---|---|
mediaTimeUs |
long : the media time of the anchor in microseconds |
nanoTimeNs |
long : the system time corresponding to the
media time in nanoseconds. |
clockRate |
float : the rate of the media clock in relation to the system time.
Value is between 0.0f and Float.MAX_VALUE inclusive |
Public methods
equals
public boolean equals (Object obj)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
obj |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
getAnchorMediaTimeUs
public long getAnchorMediaTimeUs ()
Get the media time of the anchor in microseconds.
Returns | |
---|---|
long |
getAnchorSystemNanoTime
public long getAnchorSystemNanoTime ()
Get the system time
corresponding to the media time
in nanoseconds.
Returns | |
---|---|
long |
getAnchorSytemNanoTime
public long getAnchorSytemNanoTime ()
This method was deprecated
in API level 29.
use getAnchorSystemNanoTime()
instead.
Get the system time
corresponding to the media time
in nanoseconds.
Returns | |
---|---|
long |
getMediaClockRate
public float getMediaClockRate ()
Get the rate of the media clock in relation to the system time.
It is 1.0 if media clock advances in sync with the system clock; greater than 1.0 if media clock is faster than the system clock; less than 1.0 if media clock is slower than the system clock.
Returns | |
---|---|
float |
Value is between 0.0f and Float.MAX_VALUE inclusive |
toString
public String toString ()
Returns a string representation of the object.
Returns | |
---|---|
String |
a string representation of the object. |