Package org.webrtc
Class TimestampAligner
java.lang.Object
org.webrtc.TimestampAligner
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoiddispose()Dispose native timestamp aligner.static longWrapper around rtc::TimeNanos().private static longprivate static voidnativeReleaseTimestampAligner(long timestampAligner) private static longprivate static longnativeTranslateTimestamp(long timestampAligner, long cameraTimeNs) longtranslateTimestamp(long cameraTimeNs) Translates camera timestamps to the same timescale as is used by rtc::TimeNanos().
-
Field Details
-
nativeTimestampAligner
private volatile long nativeTimestampAligner
-
-
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. -
checkNativeAlignerExists
private void checkNativeAlignerExists() -
nativeRtcTimeNanos
private static long nativeRtcTimeNanos() -
nativeCreateTimestampAligner
private static long nativeCreateTimestampAligner() -
nativeReleaseTimestampAligner
private static void nativeReleaseTimestampAligner(long timestampAligner) -
nativeTranslateTimestamp
private static long nativeTranslateTimestamp(long timestampAligner, long cameraTimeNs)
-