BugFix: prevent repeated initialization

This commit is contained in:
Bruno Herbelin
2022-01-22 00:20:40 +01:00
parent 4f915d6708
commit 35ec0c9bcf

View File

@@ -379,11 +379,6 @@ void FrameGrabber::addFrame (GstBuffer *buffer, GstCaps *caps)
if (buffer == nullptr)
return;
// first time initialization
if (pipeline_ == nullptr) {
initializer_ = std::async( FrameGrabber::initialize, this, caps);
}
// initializer ongoing in separate thread
if (initializer_.valid()) {
// try to get info from initializer
@@ -412,6 +407,10 @@ void FrameGrabber::addFrame (GstBuffer *buffer, GstCaps *caps)
}
}
}
// first time initialization
else if (pipeline_ == nullptr) {
initializer_ = std::async( FrameGrabber::initialize, this, caps);
}
// stop if an incompatilble frame buffer given after initialization
if (initialized_ && !gst_caps_is_subset( caps_, caps ))