From ceb0e150e1f8e8907906bbf190e9f28901eb19e8 Mon Sep 17 00:00:00 2001 From: zmerp Date: Sat, 18 Jan 2025 03:45:21 +0100 Subject: [PATCH] fix(client_core): :bug: Fix wrong computation of prediction (#2641) --- alvr/client_core/src/lib.rs | 4 ++-- alvr/session/src/settings.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/alvr/client_core/src/lib.rs b/alvr/client_core/src/lib.rs index f5b027a6af..d687355b22 100644 --- a/alvr/client_core/src/lib.rs +++ b/alvr/client_core/src/lib.rs @@ -237,7 +237,7 @@ impl ClientCoreContext { let target_timestamp = if let Some(stats) = &*self.connection_context.statistics_manager.lock() { - poll_timestamp + Duration::max(stats.average_total_pipeline_latency(), max_prediction) + poll_timestamp + Duration::min(stats.average_total_pipeline_latency(), max_prediction) } else { poll_timestamp }; @@ -264,7 +264,7 @@ impl ClientCoreContext { motion.angular_velocity = Vec3::ZERO; } else if let Some(stats) = &*self.connection_context.statistics_manager.lock() { let tracker_timestamp = poll_timestamp - + Duration::max(stats.tracker_prediction_offset(), max_prediction); + + Duration::min(stats.tracker_prediction_offset(), max_prediction); *motion = motion.predict(poll_timestamp, tracker_timestamp); } diff --git a/alvr/session/src/settings.rs b/alvr/session/src/settings.rs index f55237c0a6..87a3f89c36 100644 --- a/alvr/session/src/settings.rs +++ b/alvr/session/src/settings.rs @@ -1113,7 +1113,6 @@ Tilted: the world gets tilted when long pressing the oculus button. This is usef #[schema(strings( help = "Maximum prediction for head and controllers. Used to avoid too much jitter during loading." ))] - #[schema(flag = "real-time")] #[schema(gui(slider(min = 0, max = 200, step = 5)), suffix = "ms")] pub max_prediction_ms: u64, }