33 lines
1 KiB
Java
33 lines
1 KiB
Java
package org.webrtc;
|
|
public class TimestampAligner {
|
|
private volatile long nativeTimestampAligner = nativeCreateTimestampAligner();
|
|
|
|
private void checkNativeAlignerExists() {
|
|
if (this.nativeTimestampAligner == 0) {
|
|
throw new IllegalStateException("TimestampAligner has been disposed.");
|
|
}
|
|
}
|
|
|
|
public static long getRtcTimeNanos() {
|
|
return nativeRtcTimeNanos();
|
|
}
|
|
|
|
private static native long nativeCreateTimestampAligner();
|
|
|
|
private static native void nativeReleaseTimestampAligner(long j);
|
|
|
|
private static native long nativeRtcTimeNanos();
|
|
|
|
private static native long nativeTranslateTimestamp(long j, long j2);
|
|
|
|
public void dispose() {
|
|
checkNativeAlignerExists();
|
|
nativeReleaseTimestampAligner(this.nativeTimestampAligner);
|
|
this.nativeTimestampAligner = 0;
|
|
}
|
|
|
|
public long translateTimestamp(long j) {
|
|
checkNativeAlignerExists();
|
|
return nativeTranslateTimestamp(this.nativeTimestampAligner, j);
|
|
}
|
|
}
|