public final class AudioTimestamp extends Object
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.
Modifier and Type | Class and Description |
---|---|
static interface |
AudioTimestamp.Timebase |
Modifier and Type | Field and Description |
---|---|
long |
framePosition
Position in frames relative to start of an assumed audio stream.
|
long |
nanoTime
Time associated with the frame in the audio pipeline.
|
static int |
TIMEBASE_BOOTTIME
Clock monotonic including suspend time or its equivalent on the system,
in the same units and timebase as
SystemClock.elapsedRealtimeNanos() . |
static int |
TIMEBASE_MONOTONIC
Clock monotonic or its equivalent on the system,
in the same units and timebase as
System.nanoTime() . |
Constructor and Description |
---|
AudioTimestamp() |
public static final int TIMEBASE_MONOTONIC
System.nanoTime()
.public static final int TIMEBASE_BOOTTIME
SystemClock.elapsedRealtimeNanos()
.public long framePosition
When obtained through
AudioRecord.getTimestamp(AudioTimestamp, int)
,
all 64 bits of position are valid.
When obtained through
AudioTrack.getTimestamp(AudioTimestamp)
,
the low-order 32 bits of position is in wrapping frame units similar to
AudioTrack.getPlaybackHeadPosition()
.
public long nanoTime
When obtained through
AudioRecord.getTimestamp(AudioTimestamp, int)
,
this is the estimated time in nanoseconds when the frame referred to by
framePosition
was captured. The timebase is either
TIMEBASE_MONOTONIC
or TIMEBASE_BOOTTIME
, depending
on the timebase parameter used in
AudioRecord.getTimestamp(AudioTimestamp, int)
.
When obtained through
AudioTrack.getTimestamp(AudioTimestamp)
,
this is the estimated time when the frame was presented or is committed to be presented,
with a timebase of TIMEBASE_MONOTONIC
.