Discard predictions only when they can be replaced
This commit is contained in:
+5
-10
@@ -76,17 +76,12 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Discard outdated predictions
|
// Discard outdated predictions
|
||||||
if (t != produced)
|
for (auto it = data.begin(); it != data.end();)
|
||||||
{
|
{
|
||||||
for (auto it = data.begin(); it != data.end();)
|
if (std::abs(it->at_timestamp_ns - t) < 2'000'000 and it->produced_timestamp < produced)
|
||||||
{
|
it = data.erase(it);
|
||||||
if (it->at_timestamp_ns == it->produced_timestamp // not a prediction
|
else
|
||||||
or it->produced_timestamp >= produced // recent prediction
|
++it;
|
||||||
or it->at_timestamp_ns > t + 1'000'000) // we don't have far enough data yet
|
|
||||||
++it;
|
|
||||||
else
|
|
||||||
it = data.erase(it);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert the new sample
|
// Insert the new sample
|
||||||
|
|||||||
Reference in New Issue
Block a user