replay: fix hanging on exit if stream thread has not been started yet (#22770)

pull/22778/head
Dean Lee 4 years ago committed by GitHub
parent 6de66f2832
commit 6f78cc77fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      selfdrive/ui/replay/filereader.cc
  2. 1
      selfdrive/ui/replay/framereader.cc
  3. 15
      selfdrive/ui/replay/replay.cc

@ -18,7 +18,7 @@ std::string cacheFilePath(const std::string &url) {
return comma_cache.back() == '/' ? comma_cache : comma_cache + "/";
}();
return cache_path + sha256(getUrlWithoutQuery(url));;
return cache_path + sha256(getUrlWithoutQuery(url));
}
std::string FileReader::read(const std::string &file, std::atomic<bool> *abort) {

@ -44,7 +44,6 @@ FrameReader::FrameReader(bool local_cache, int chunk_size, int retries) : FileRe
av_frame_ = av_frame_alloc();
rgb_frame_ = av_frame_alloc();
yuv_frame_ = av_frame_alloc();;
}
FrameReader::~FrameReader() {

@ -41,15 +41,16 @@ Replay::~Replay() {
}
void Replay::stop() {
if (stream_thread_ == nullptr) return;
if (!stream_thread_ && segments_.empty()) return;
qDebug() << "shutdown: in progress...";
exit_ = updating_events_ = true;
stream_cv_.notify_one();
stream_thread_->quit();
stream_thread_->wait();
stream_thread_ = nullptr;
if (stream_thread_ != nullptr) {
exit_ = updating_events_ = true;
stream_cv_.notify_one();
stream_thread_->quit();
stream_thread_->wait();
stream_thread_ = nullptr;
}
segments_.clear();
camera_server_.reset(nullptr);
qDebug() << "shutdown: done";

Loading…
Cancel
Save