Package tvi.webrtc

Class TimestampAligner


  • public class TimestampAligner
    extends java.lang.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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Dispose native timestamp aligner.
      static long getRtcTimeNanos()
      Wrapper around rtc::TimeNanos().
      long translateTimestamp​(long cameraTimeNs)
      Translates camera timestamps to the same timescale as is used by rtc::TimeNanos().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimestampAligner

        public TimestampAligner()
    • Method Detail

      • 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.