fix(api): Remove duplicate frames,change samples after disparity with enum BM
This commit is contained in:
@@ -24,7 +24,9 @@
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
Processor::Processor(std::int32_t proc_period)
|
||||
: proc_period_(std::move(proc_period)),
|
||||
: last_frame_id_cd(0),
|
||||
last_frame_id_cd_vice(0),
|
||||
proc_period_(std::move(proc_period)),
|
||||
activated_(false),
|
||||
input_ready_(false),
|
||||
idle_(true),
|
||||
@@ -278,11 +280,16 @@ api::StreamData Processor::GetStreamData(const Stream &stream) {
|
||||
if (enable_mode == Synthetic::MODE_ON) {
|
||||
if (sum == 1) {
|
||||
if (out != nullptr) {
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
auto output = Object::Cast<ObjMat>(out);
|
||||
if (output != nullptr) {
|
||||
if (last_frame_id_cd == output->data->frame_id) {
|
||||
// cut the duplicate frame.
|
||||
return {};
|
||||
}
|
||||
last_frame_id_cd = output->data->frame_id;
|
||||
return obj_data(output);
|
||||
}
|
||||
VLOG(2) << "Rectify not ready now";
|
||||
VLOG(2) << "Frame not ready now";
|
||||
}
|
||||
} else if (sum == 2) {
|
||||
static std::shared_ptr<ObjMat2> output = nullptr;
|
||||
@@ -295,15 +302,26 @@ api::StreamData Processor::GetStreamData(const Stream &stream) {
|
||||
for (auto it : streams) {
|
||||
if (it.stream == stream) {
|
||||
if (num == 1) {
|
||||
if (last_frame_id_cd == output->first_data->frame_id) {
|
||||
// cut the duplicate frame.
|
||||
return {};
|
||||
}
|
||||
last_frame_id_cd = output->first_data->frame_id;
|
||||
return obj_data_first(output);
|
||||
} else {
|
||||
// last_frame_id_cd = output->second_data->frame_id;
|
||||
if (last_frame_id_cd_vice == output->second_data->frame_id) {
|
||||
// cut the duplicate frame.
|
||||
return {};
|
||||
}
|
||||
last_frame_id_cd_vice = output->second_data->frame_id;
|
||||
return obj_data_second(output);
|
||||
}
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
VLOG(2) << "Rectify not ready now";
|
||||
VLOG(2) << "Frame not ready now";
|
||||
} else {
|
||||
LOG(ERROR) << "error: invalid sum!";
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ class Processor :
|
||||
|
||||
virtual process_type ProcessOutputConnection();
|
||||
virtual process_type ProcessInputConnection();
|
||||
|
||||
std::uint16_t last_frame_id_cd;
|
||||
std::uint16_t last_frame_id_cd_vice;
|
||||
private:
|
||||
/** Run in standalone thread. */
|
||||
void Run();
|
||||
|
||||
@@ -90,10 +90,6 @@ void s1s2Processor::StartVideoStreaming() {
|
||||
[this, stream, callback](const device::StreamData &data) {
|
||||
auto &&stream_data = data2api(data);
|
||||
ProcessNativeStream(stream, stream_data);
|
||||
// Need mutex if set callback after start
|
||||
// if (callback) {
|
||||
// callback(stream_data);
|
||||
// }
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user