diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index 3e555eb2ee5dbb569f1fa613e4330d4803db0272..19a5709d3dead3c3fe736f4ba346cf81392f5b6b 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -249,6 +249,18 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce */ virtual bool triggerInKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) = 0; + /** \brief store key frame + * + * Returns true if the key frame should be stored + */ + virtual bool storeKeyFrame(FrameBasePtr) = 0; + + /** \brief store capture + * + * Returns true if the capture should be stored + */ + virtual bool storeCapture(CaptureBasePtr) = 0; + /** \brief Vote for KeyFrame generation * * If a KeyFrame criterion is validated, this function returns true, diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp index 4d9e937028360e651dfbb0377927ad2186244b8e..3276f333514c074e436a3c0b7ea1af9973d5b7f1 100644 --- a/src/processor/processor_base.cpp +++ b/src/processor/processor_base.cpp @@ -36,8 +36,10 @@ void ProcessorBase::keyFrameCallback(FrameBasePtr _keyframe_ptr, const Scalar& _ WOLF_DEBUG("P", isMotion() ? "M " : "T ", getName(), ": KF", _keyframe_ptr->id(), " callback received with ts = ", _keyframe_ptr->getTimeStamp()); assert(_keyframe_ptr != nullptr && "keyFrameCallback with a nullptr frame"); - // buffering anyway - buffer_pack_kf_.add(_keyframe_ptr, _time_tol_other); + + // asking if key frame should be stored + if (storeKeyFrame(_keyframe_ptr)) + buffer_pack_kf_.add(_keyframe_ptr, _time_tol_other); // if trigger true -> processKeyFrame if (triggerInKeyFrame(_keyframe_ptr, _time_tol_other)) @@ -53,7 +55,8 @@ void ProcessorBase::captureCallback(CaptureBasePtr _capture_ptr) // if trigger, process directly without buffering if (triggerInCapture(_capture_ptr)) processCapture(_capture_ptr); - else + // asking if capture should be stored + if (storeCapture(_capture_ptr)) buffer_capture_.add(_capture_ptr->getTimeStamp(), _capture_ptr); }