mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-26 01:43:52 +08:00
replay: fix hanging on exit if stream thread has not been started yet (#22770)
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user