replay: add stop() function (#32673)

add stop() func
old-commit-hash: 3f84fe3557
097
Dean Lee 11 months ago committed by GitHub
parent 8bdeb04e72
commit 40de8d615f
  1. 4
      tools/cabana/streams/replaystream.cc
  2. 6
      tools/replay/replay.cc
  3. 1
      tools/replay/replay.h

@ -65,7 +65,9 @@ void ReplayStream::start() {
} }
void ReplayStream::stop() { void ReplayStream::stop() {
replay.reset(nullptr); if (replay) {
replay->stop();
}
} }
bool ReplayStream::eventFilter(const Event *event) { bool ReplayStream::eventFilter(const Event *event) {

@ -46,11 +46,15 @@ Replay::Replay(QString route, QStringList allow, QStringList block, SubMaster *s
} }
Replay::~Replay() { Replay::~Replay() {
stop();
}
void Replay::stop() {
if (!stream_thread_ && segments_.empty()) return; if (!stream_thread_ && segments_.empty()) return;
rInfo("shutdown: in progress..."); rInfo("shutdown: in progress...");
if (stream_thread_ != nullptr) { if (stream_thread_ != nullptr) {
exit_ =true; exit_ = true;
paused_ = true; paused_ = true;
stream_cv_.notify_one(); stream_cv_.notify_one();
stream_thread_->quit(); stream_thread_->quit();

@ -54,6 +54,7 @@ public:
~Replay(); ~Replay();
bool load(); bool load();
void start(int seconds = 0); void start(int seconds = 0);
void stop();
void pause(bool pause); void pause(bool pause);
void seekToFlag(FindFlag flag); void seekToFlag(FindFlag flag);
void seekTo(double seconds, bool relative); void seekTo(double seconds, bool relative);

Loading…
Cancel
Save