mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-26 03:46:28 -08:00
Fix PoseRecorder frame timing
This commit is contained in:
1 file changed
+11
-5
@@ -37,11 +37,17 @@ public class PoseRecorder {
|
||||
if(numFrames > 0) {
|
||||
PoseFrame poseFrame = this.poseFrame;
|
||||
List<Pair<Tracker, PoseFrameTracker>> trackers = this.trackers;
|
||||
if(poseFrame != null && trackers != null) {
|
||||
if(frameCursor < numFrames) {
|
||||
if(System.currentTimeMillis() >= nextFrameTimeMs) {
|
||||
nextFrameTimeMs = System.currentTimeMillis() + frameRecordingInterval;
|
||||
|
||||
if (poseFrame != null && trackers != null) {
|
||||
if (frameCursor < numFrames) {
|
||||
long curTime = System.currentTimeMillis();
|
||||
if (curTime >= nextFrameTimeMs) {
|
||||
nextFrameTimeMs += frameRecordingInterval;
|
||||
|
||||
// To prevent duplicate frames, make sure the frame time is always in the future
|
||||
if (nextFrameTimeMs <= curTime) {
|
||||
nextFrameTimeMs = curTime + frameRecordingInterval;
|
||||
}
|
||||
|
||||
int cursor = frameCursor++;
|
||||
for(Pair<Tracker, PoseFrameTracker> tracker : trackers) {
|
||||
// Add a frame for each tracker
|
||||
|
||||
Reference in new issue
Block a user