Handle reodered tracking packets better

This commit is contained in:
Patrick Nicolas
2024-04-14 15:02:14 +02:00
parent 09c2bf19e5
commit e9293d8b6e
3 changed files with 84 additions and 3 deletions
+7
View File
@@ -44,6 +44,13 @@ protected:
XrTime t = offset.from_headset(timestamp);
std::lock_guard lock(mutex);
// Discard outdated data, packets could be reordered
if (not data.empty())
{
if (data.back().produced_timestamp > produced)
return;
}
// Only keep one predicted value
// It should be the last one
if (not data.empty() and t != produced and data.back().at_timestamp_ns != data.back().produced_timestamp)