feat: implement thread-safe image saving with mutex and update save logic

This commit is contained in:
ob-yalian
2026-08-20 17:12:20 +08:00
parent 54d29f15d8
commit ada0122f98
3 changed files with 22 additions and 8 deletions
+2 -1
View File
@@ -1961,10 +1961,11 @@ void OBCameraNode::saveImageCallback(const std::shared_ptr<std_srvs::srv::Empty:
std::shared_ptr<std_srvs::srv::Empty::Response>& response) {
(void)request;
(void)response;
std::lock_guard<std::mutex> lock(save_images_mutex_);
for (const auto& stream_index : IMAGE_STREAMS) {
if (enable_stream_[stream_index]) {
save_images_[stream_index] = true;
save_images_count_[stream_index] = 0;
save_images_[stream_index].store(true, std::memory_order_release);
}
}
}