Skip to content

Commit

Permalink
do nothing if tm less than current mono time
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Dec 16, 2021
1 parent 36eab4b commit 46cc3f1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions selfdrive/ui/replay/replay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,22 @@ void Replay::doSeek(int seconds, bool relative) {

void Replay::doSeekToFlag(FindFlag flag) {
if (flag == FindFlag::nextEngagement) {
qInfo() << "seeking to the next engagement...";
qInfo() << "seeking to the next engagement...";
} else if (flag == FindFlag::nextDisEngagement) {
qInfo() << "seeking to the disengagement...";
qInfo() << "seeking to the disengagement...";
}

updateEvents([&]() {
if (auto next = find(flag)) {
cur_mono_time_ = *next - 2 * 1e9; // seek to 2 seconds before next;
uint64_t tm = *next - 2 * 1e9; // seek to 2 seconds before next
if (tm <= cur_mono_time_) {
if (flag == FindFlag::nextEngagement) {
qInfo() << "already in engagement";
}
return true;
}

cur_mono_time_ = tm;
current_segment_ = currentSeconds() / 60;
return isSegmentMerged(current_segment_);
} else {
Expand Down

0 comments on commit 46cc3f1

Please sign in to comment.