diff --git a/src/background-filter.cpp b/src/background-filter.cpp index 1952adad..a59bf403 100644 --- a/src/background-filter.cpp +++ b/src/background-filter.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "plugin-macros.generated.h" #include "models/ModelSINET.h" @@ -56,7 +57,6 @@ struct background_removal_filter { std::vector> outputDims; std::vector> outputTensorValues; std::vector> inputTensorValues; - Ort::MemoryInfo memoryInfo; float threshold = 0.5f; cv::Scalar backgroundColor{0, 0, 0, 0}; float contourFilter = 0.05f; @@ -290,8 +290,8 @@ static void filter_update(void *data, obs_data_t *settings) static void *filter_create(obs_data_t *settings, obs_source_t *source) { - struct background_removal_filter *tf = reinterpret_cast( - bzalloc(sizeof(struct background_removal_filter))); + void *data = bmalloc(sizeof(struct background_removal_filter)); + struct background_removal_filter *tf = new (data) background_removal_filter(); tf->source = source; tf->texrender = gs_texrender_create(GS_BGRA, GS_ZS_NONE); @@ -316,6 +316,7 @@ static void filter_destroy(void *data) gs_stagesurface_destroy(tf->stagesurface); } obs_leave_graphics(); + tf->~background_removal_filter(); bfree(tf); } }