[][src]Function aaudio_sys::AAudioStream_getTimestamp

pub unsafe extern "C" fn AAudioStream_getTimestamp(
    stream: *mut AAudioStream,
    clockid: clockid_t,
    frame_positon: *mut i64,
    time_nanoseconds: *mut i64
) -> i32

Passes back the time at which a particular frame was presented. This can be used to synchronize audio with video or MIDI. It can also be used to align a recorded stream with a playback stream. Returns 0 for OK or a negative error.

Timestamps are only valid when the stream is in STREAM_STATE_STARTED. ERROR_INVALID_STATE will be returned if the stream is not started. Note that because requestStart() is asynchronous, timestamps will not be valid until a short time after calling requestStart(). So ERROR_INVALID_STATE should not be considered a fatal error. Just try calling again later.

If an error occurs, then the position and time will not be modified.

The position and time passed back are monotonically increasing.

Available since API level 26.

Arguments

  • stream - reference provided by AAudioStreamBuilder_openStream()
  • clockid - CLOCK_MONOTONIC or CLOCK_BOOTTIME
  • frame_position - pointer to a variable to receive the position
  • time_nanoseconds - pointer to a variable to receive the time