diff --git a/src/processor/motion_buffer.cpp b/src/processor/motion_buffer.cpp index 5735441cb55404882bf9cd32c712a843daa61324..37f840a505c86754b6e6a4d865a45e441d6feac1 100644 --- a/src/processor/motion_buffer.cpp +++ b/src/processor/motion_buffer.cpp @@ -107,8 +107,8 @@ void MotionBuffer::getMotion(const TimeStamp& _ts, Motion& _motion) const void MotionBuffer::split(const TimeStamp& _ts, MotionBuffer& _buffer_part_before_ts) { - assert((container_.front().ts_ <= _ts) && "Error: Query time stamp is greater than the buffer's last tick"); - assert((container_.back().ts_ >= _ts) && "Error: Query time stamp is smaller than the buffer's first tick"); + assert((container_.front().ts_ <= _ts) && "Error: Query time stamp is smaller than the buffer's first tick"); + assert((container_.back().ts_ >= _ts) && "Error: Query time stamp is greater than the buffer's last tick"); _buffer_part_before_ts.setCalibrationPreint(calib_preint_); diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index 02b975499940b2e01d0e477f843d8d2b496a1fda..a33fcde2cac2a04d149f759e1e1ad08c574c041e 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -96,7 +96,6 @@ void ProcessorMotion::process(CaptureBasePtr _incoming_ptr) switch(processing_step_) { - case RUNNING_WITHOUT_PACK : case RUNNING_WITH_PACK_ON_ORIGIN : break; @@ -658,6 +657,10 @@ PackKeyFramePtr ProcessorMotion::computeProcessingStep() PackKeyFramePtr pack = buffer_pack_kf_.selectFirstPackBefore(last_ptr_, params_motion_->time_tolerance); + // ignore "future" KF to avoid MotionBuffer::split() error + if (pack && pack->key_frame->getTimeStamp() > last_ptr_->getBuffer().get().back().ts_) + pack = nullptr; + if (pack) { if (buffer_pack_kf_.checkTimeTolerance(pack->key_frame->getTimeStamp(), pack->time_tolerance, origin_ptr_->getTimeStamp(), params_motion_->time_tolerance))