fix(correspondence): also wait stream matched ready
This commit is contained in:
parent
e6d2d3ebe4
commit
5b5ded25c9
|
@ -171,9 +171,13 @@ void Correspondence::NotifyStreamDataReady() {
|
|||
|
||||
bool Correspondence::IsStreamDataReady() {
|
||||
if (stream_datas_.empty()) return false;
|
||||
if (stream_match_enabled_) {
|
||||
if (stream_datas_match_.empty()) return false;
|
||||
}
|
||||
if (motion_datas_.empty()) return false;
|
||||
|
||||
std::uint64_t img_stamp = 0;
|
||||
std::uint64_t img_macth_stamp = 0;
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> _(mtx_stream_datas_);
|
||||
auto data = stream_datas_.front();
|
||||
|
@ -181,6 +185,10 @@ bool Correspondence::IsStreamDataReady() {
|
|||
LOG(FATAL) << "stream data image info is empty!";
|
||||
}
|
||||
img_stamp = data.img->timestamp;
|
||||
|
||||
if (stream_match_enabled_) {
|
||||
img_macth_stamp = stream_datas_match_.front().img->timestamp;
|
||||
}
|
||||
}
|
||||
std::uint64_t imu_stamp = 0;
|
||||
{
|
||||
|
@ -192,8 +200,13 @@ bool Correspondence::IsStreamDataReady() {
|
|||
imu_stamp = data.imu->timestamp;
|
||||
}
|
||||
|
||||
if (stream_match_enabled_) {
|
||||
return img_stamp + stream_interval_us_half_ < imu_stamp
|
||||
&& img_macth_stamp + stream_interval_us_half_ < imu_stamp;
|
||||
} else {
|
||||
return img_stamp + stream_interval_us_half_ < imu_stamp;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<api::StreamData> Correspondence::GetReadyStreamData(bool matched) {
|
||||
std::uint64_t imu_stamp = 0;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#define MYNTEYE_API_CONFIG_H_
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
@ -57,7 +58,7 @@ class Correspondence {
|
|||
std::shared_ptr<Device> device_;
|
||||
Stream stream_;
|
||||
Stream stream_match_;
|
||||
bool stream_match_enabled_;
|
||||
std::atomic_bool stream_match_enabled_;
|
||||
|
||||
float stream_interval_us_;
|
||||
float stream_interval_us_half_;
|
||||
|
|
Loading…
Reference in New Issue
Block a user