diff --git a/src/monolithic/gst/inference_elements/base/inference_singleton.cpp b/src/monolithic/gst/inference_elements/base/inference_singleton.cpp index bbe72bc9..a3ee6d86 100644 --- a/src/monolithic/gst/inference_elements/base/inference_singleton.cpp +++ b/src/monolithic/gst/inference_elements/base/inference_singleton.cpp @@ -5,6 +5,8 @@ ******************************************************************************/ #include "inference_singleton.h" +#include "gva_base_inference_priv.hpp" +#include "inference_backend/buffer_mapper.h" #include "gva_base_inference.h" #include "inference_impl.h" @@ -15,6 +17,7 @@ struct InferenceRefs { std::set refs; InferenceImpl *proxy = nullptr; + dlstreamer::ContextPtr context = nullptr; GstVideoFormat videoFormat = GST_VIDEO_FORMAT_UNKNOWN; CapsFeature capsFeature = ANY_CAPS_FEATURE; }; @@ -167,8 +170,12 @@ InferenceImpl *acquire_inference_instance(GvaBaseInference *base_inference) { // if base_inference is not master element, it will get all master element's properties here initExistingElements(infRefs); - if (infRefs->proxy == nullptr) // no instance for current inference-id acquired yet + if (infRefs->proxy == nullptr) { // no instance for current inference-id acquired yet infRefs->proxy = new InferenceImpl(base_inference); // one instance for all elements with same inference-id + infRefs->context = base_inference->priv->va_display; + } else { + base_inference->priv->va_display = infRefs->context; + } return infRefs->proxy; } catch (const std::exception &e) {