Skip to content

Commit

Permalink
Move checking fps
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Apr 18, 2024
1 parent b0958f3 commit 8f3abd0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/rpi/common/src/car/system/device/CameraDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ namespace car::system::device
}

void CameraDevice::update() {
const auto now = std::chrono::steady_clock::now();
if ((now - this->last).count() < this->configuration->getCameraFpsInterval()) {
std::lock_guard<std::mutex> lock(this->camera_mutex_);
if (!this->connected_ || this->camera_ == nullptr || !this->camera_->isOpened()) {
this->frame_buffer_ = "";
return;
}
this->last = now;
std::lock_guard<std::mutex> lock(this->camera_mutex_);
if (!this->connected_ || this->camera_ == nullptr || !this->camera_->isOpened()) {
const auto now = std::chrono::steady_clock::now();
if ((now - this->last).count() < this->configuration->getCameraFpsInterval()) {
this->frame_buffer_ = "";
return;
}
this->last = now;
cv::Mat frame;
(*this->camera_) >> frame;
if (frame.empty()) {
Expand Down

0 comments on commit 8f3abd0

Please sign in to comment.