Package tvi.webrtc

Class TimestampAligner

java.lang.Object
tvi.webrtc.TimestampAligner

public class TimestampAligner extends Object
The TimestampAligner class helps translating camera timestamps into the same timescale as is used by rtc::TimeNanos(). Some cameras have built in timestamping which is more accurate than reading the system clock, but using a different epoch and unknown clock drift. Frame timestamps in webrtc should use rtc::TimeNanos (system monotonic time), and this class provides a filter which lets us use the rtc::TimeNanos timescale, and at the same time take advantage of higher accuracy of the camera clock. This class is a wrapper on top of rtc::TimestampAligner.
  • Constructor Details

    • TimestampAligner

      public TimestampAligner()
  • Method Details

    • getRtcTimeNanos

      public static long getRtcTimeNanos()
      Wrapper around rtc::TimeNanos(). This is normally same as System.nanoTime(), but call this function to be safe.
    • translateTimestamp

      public long translateTimestamp(long cameraTimeNs)
      Translates camera timestamps to the same timescale as is used by rtc::TimeNanos(). `cameraTimeNs` is assumed to be accurate, but with an unknown epoch and clock drift. Returns the translated timestamp.
    • dispose

      public void dispose()
      Dispose native timestamp aligner.