Queue filters until there are at least 2 points each
We were seeing issues where each channel had 1 message at start, then a
*long* time gap, then the body of the messages. We would queue the 1
message up, do time estimation, freeze past that message, then find the
body of data. That was resulting in us not being able to read
reasonably phrased logs.
The fix is to make sure to queue 2 points for each active filter (plus a
bit after so we don't immediately try to modify it).
Change-Id: I41455bf3c2426233a72f40035430f1bc0c420fdc
diff --git a/aos/events/logging/logfile_utils.h b/aos/events/logging/logfile_utils.h
index 632b1df..d251772 100644
--- a/aos/events/logging/logfile_utils.h
+++ b/aos/events/logging/logfile_utils.h
@@ -520,6 +520,19 @@
// Queues until we have time_estimation_buffer of data in the queue.
void QueueFor(std::chrono::nanoseconds time_estimation_buffer);
+ // Queues until the condition is met.
+ template <typename T>
+ void QueueUntilCondition(T fn) {
+ while (true) {
+ if (fn()) {
+ break;
+ }
+ if (!QueueMatched()) {
+ break;
+ }
+ }
+ }
+
// Sets a callback to be called whenever a full message is queued.
void set_timestamp_callback(std::function<void(TimestampedMessage *)> fn) {
timestamp_callback_ = fn;