From 45cedde1aef5359cbe00e92ee49fab66775bb33d Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 5 Oct 2021 22:48:27 +0200 Subject: [PATCH] filter/denoising: Restrict size to reasonable numbers Prevents invalid sizes from being used by the filter, which sometimes happens with Async Sources that aren't quite ready yet. Fixes: #642 --- source/filters/filter-denoising.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/filters/filter-denoising.cpp b/source/filters/filter-denoising.cpp index 8e3bd1e9..c527fe11 100644 --- a/source/filters/filter-denoising.cpp +++ b/source/filters/filter-denoising.cpp @@ -180,10 +180,15 @@ uint32_t streamfx::filter::denoising::denoising_instance::get_height() void denoising_instance::video_tick(float_t time) { + auto parent = obs_filter_get_parent(_self); auto target = obs_filter_get_target(_self); auto width = obs_source_get_base_width(target); auto height = obs_source_get_base_height(target); - _size = {width, height}; + + // Verify that the detected size makes sense. + if ((width > 0) && (height > 0)) { + _size = {width, height}; + } // Allow the provider to restrict the size. if (target && _provider_ready) {