diff --git a/modules/gapi/src/compiler/gislandmodel.hpp b/modules/gapi/src/compiler/gislandmodel.hpp index dc230aae27..1d2ff6de61 100644 --- a/modules/gapi/src/compiler/gislandmodel.hpp +++ b/modules/gapi/src/compiler/gislandmodel.hpp @@ -123,6 +123,24 @@ public: virtual bool canReshape() const = 0; virtual void reshape(ade::Graph& g, const GCompileArgs& args) = 0; + // This method is called when the GStreamingCompiled gets a new + // input source to process. Normally this method is called once + // per stream execution. + // + // The idea of this method is to reset backend's stream-associated + // internal state, if there is any. + // + // The regular GCompiled invocation doesn't call this, there may + // be reset() introduced there but it is completely unnecessary at + // this moment. + // + // FIXME: The design on this and so-called "stateful" kernels is not + // closed yet. + // FIXME: This thing will likely break stuff once we introduce + // "multi-source streaming", a better design needs to be proposed + // at that stage. + virtual void handleNewStream() {}; // do nothing here by default + virtual ~GIslandExecutable() = default; }; diff --git a/modules/gapi/src/executor/gstreamingexecutor.cpp b/modules/gapi/src/executor/gstreamingexecutor.cpp index e5e497ce0b..21b5ab6757 100644 --- a/modules/gapi/src/executor/gstreamingexecutor.cpp +++ b/modules/gapi/src/executor/gstreamingexecutor.cpp @@ -859,6 +859,7 @@ void cv::gimpl::GStreamingExecutor::setSource(GRunArgs &&ins) for (auto &&out_eh : op.nh->outNodes()) { out_queues.push_back(reader_queues(*m_island_graph, out_eh)); } + op.isl_exec->handleNewStream(); m_threads.emplace_back(islandActorThread, op.in_objects,