Skip to content

Commit

Permalink
replay: add stop() function (#32673)
Browse files Browse the repository at this point in the history
add stop() func
  • Loading branch information
deanlee committed Jun 9, 2024
1 parent 6688d7b commit 3f84fe3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tools/cabana/streams/replaystream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ void ReplayStream::start() {
}

void ReplayStream::stop() {
replay.reset(nullptr);
if (replay) {
replay->stop();
}
}

bool ReplayStream::eventFilter(const Event *event) {
Expand Down
6 changes: 5 additions & 1 deletion tools/replay/replay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ Replay::Replay(QString route, QStringList allow, QStringList block, SubMaster *s
}

Replay::~Replay() {
stop();
}

void Replay::stop() {
if (!stream_thread_ && segments_.empty()) return;

rInfo("shutdown: in progress...");
if (stream_thread_ != nullptr) {
exit_ =true;
exit_ = true;
paused_ = true;
stream_cv_.notify_one();
stream_thread_->quit();
Expand Down
1 change: 1 addition & 0 deletions tools/replay/replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Replay : public QObject {
~Replay();
bool load();
void start(int seconds = 0);
void stop();
void pause(bool pause);
void seekToFlag(FindFlag flag);
void seekTo(double seconds, bool relative);
Expand Down

0 comments on commit 3f84fe3

Please sign in to comment.