Fix OFX plugin render failures and stabilize integration tests
This commit resolves several categories of OFX plugin failures that
manifested as magenta (pink) render output or crashes:
1. Param default-value initialization
- IntegerInstance, DoubleInstance, BooleanInstance, ChoiceInstance,
and StringInstance now read kOfxParamPropDefault from the descriptor
at construction time. Previously, when no PluginNode was attached
(integration-test mode), get() returned 0/0.0/false, causing
generator plugins to receive invalid extent/format/PAR values and
crash in coordinate assertions.
- IntegerInstance also fixed uninitialized `id` that caused
kOfxStatErrBadHandle in CImg plugins.
2. Clip property initialization
- newClipInstance() now seeds pixelDepth and components from the
host VideoParams instead of leaving them as None. This prevents
Transform3x3Plugin and similar plugins from asserting on
getPixelComponentCount() during fetchClip inside createInstance.
- getAspectRatio() and getProjectPixelAspectRatio() now fall back
to 1.0 when the project's PAR is not yet set, avoiding division-
by-zero in coordinate conversion.
3. Frame-rate and time-base preservation
- setInputTexture() no longer overwrites the clip's frame_rate or
time_base with the input texture's values. Multi-input plugins
were crashing because setupClipPreferencesArgs throws when inputs
have mismatched rates.
4. Render loop hardening
- getClipPreferences() is now wrapped in try/catch so that frame-
rate mismatch exceptions mark render failure instead of aborting
the render thread.
- getRegionOfInterestAction() treats kOfxStatErrBadHandle as non-
fatal and falls back to default RoI.
- RenderPlugin syncs all clip instances after setVideoParam so that
getAspectRatio/getFrameRate return valid values before
createInstanceAction queries them.
5. Test suite updates
- All PluginMisc tests now use F32 input to match the host pipeline
default.
- CreateGradientTexture fixed to support F32 pixel format.
- Added CImgBilateral and CImgGuided_MultiInput tests.
- Secret parameters are now registered as hidden Node inputs so that
getClipPreferences can read them (fixes generator pink screen).
6. Debug logging in HostSupport
- clipGetImage and clipGetRegionOfDefinition now catch exceptions
and log the failing clip name for easier debugging.
This commit is contained in:
+38
-9
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace OFX {
|
||||
|
||||
@@ -2004,31 +2005,47 @@ namespace OFX {
|
||||
const OfxRectD *h2,
|
||||
OfxPropertySetHandle *h3)
|
||||
{
|
||||
ClipInstance *clipInstance = nullptr;
|
||||
try {
|
||||
if (!h3) {
|
||||
std::cerr << "[clipGetImage] h3 is null" << std::endl;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
|
||||
ClipInstance *clipInstance = reinterpret_cast<ClipInstance*>(h1);
|
||||
clipInstance = reinterpret_cast<ClipInstance*>(h1);
|
||||
|
||||
if (!clipInstance || !clipInstance->verifyMagic()) {
|
||||
if (!clipInstance) {
|
||||
std::cerr << "[clipGetImage] clipInstance is null" << std::endl;
|
||||
*h3 = NULL;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
if (!clipInstance->verifyMagic()) {
|
||||
std::cerr << "[clipGetImage] verifyMagic failed for clip=" << clipInstance->getName() << std::endl;
|
||||
*h3 = NULL;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
|
||||
Image* image = clipInstance->getImage(time,h2);
|
||||
if(!image) {
|
||||
std::cerr << "[clipGetImage] getImage returned null for clip=" << clipInstance->getName() << " time=" << time << std::endl;
|
||||
*h3 = NULL;
|
||||
|
||||
return kOfxStatFailed;
|
||||
}
|
||||
|
||||
*h3 = image->getPropHandle();
|
||||
if (!*h3) {
|
||||
std::cerr << "[clipGetImage] getPropHandle returned null for clip=" << clipInstance->getName() << std::endl;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
|
||||
return kOfxStatOK;
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << "[clipGetImage] exception: " << e.what() << " clip=" << (clipInstance ? clipInstance->getName() : "null") << std::endl;
|
||||
*h3 = NULL;
|
||||
return kOfxStatErrBadHandle;
|
||||
} catch (...) {
|
||||
std::cerr << "[clipGetImage] unknown exception clip=" << (clipInstance ? clipInstance->getName() : "null") << std::endl;
|
||||
*h3 = NULL;
|
||||
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
}
|
||||
@@ -2095,28 +2112,40 @@ namespace OFX {
|
||||
OfxTime time,
|
||||
OfxRectD *bounds)
|
||||
{
|
||||
ClipInstance *clipInstance = nullptr;
|
||||
try {
|
||||
if (!bounds) {
|
||||
std::cerr << "[clipGetRegionOfDefinition] bounds is null" << std::endl;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
|
||||
ClipInstance *clipInstance = reinterpret_cast<ClipInstance*>(clip);
|
||||
clipInstance = reinterpret_cast<ClipInstance*>(clip);
|
||||
|
||||
if (!clipInstance || !clipInstance->verifyMagic()) {
|
||||
if (!clipInstance) {
|
||||
std::cerr << "[clipGetRegionOfDefinition] clipInstance is null" << std::endl;
|
||||
bounds->x1 = bounds->y1 = bounds->x2 = bounds->y2 = 0.;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
if (!clipInstance->verifyMagic()) {
|
||||
std::cerr << "[clipGetRegionOfDefinition] verifyMagic failed for clip=" << clipInstance->getName() << std::endl;
|
||||
bounds->x1 = bounds->y1 = bounds->x2 = bounds->y2 = 0.;
|
||||
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
|
||||
*bounds = clipInstance->getRegionOfDefinition(time);
|
||||
if (bounds->x2 < bounds->x1 || bounds->y2 < bounds->y1) {
|
||||
// the RoD is invalid (empty is OK)
|
||||
|
||||
std::cerr << "[clipGetRegionOfDefinition] invalid RoD for clip=" << clipInstance->getName() << std::endl;
|
||||
return kOfxStatFailed;
|
||||
}
|
||||
|
||||
return kOfxStatOK;
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << "[clipGetRegionOfDefinition] exception: " << e.what() << " clip=" << (clipInstance ? clipInstance->getName() : "null") << std::endl;
|
||||
bounds->x1 = bounds->y1 = bounds->x2 = bounds->y2 = 0.;
|
||||
return kOfxStatErrBadHandle;
|
||||
} catch (...) {
|
||||
std::cerr << "[clipGetRegionOfDefinition] unknown exception clip=" << (clipInstance ? clipInstance->getName() : "null") << std::endl;
|
||||
bounds->x1 = bounds->y1 = bounds->x2 = bounds->y2 = 0.;
|
||||
return kOfxStatErrBadHandle;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user