From 15334c89d6b4cf066e5d5fc6b78439090cabb4cd Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 3 May 2022 17:58:41 +1000 Subject: [PATCH] [host] dxgi: match the last entry in the downsample rule list --- host/platform/Windows/capture/DXGI/src/dxgi.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index d5b25b04..396373d2 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -598,24 +598,29 @@ static bool dxgi_init(void) goto fail; } - this->targetWidth = this->width; - this->targetHeight = this->height; + this->downsampleLevel = 0; + this->targetWidth = this->width; + this->targetHeight = this->height; - DownsampleRule * rule; + DownsampleRule * rule, * match = NULL; vector_forEachRef(rule, &downsampleRules) { if ( ( rule->greater && (this->width > rule->x || this->height > rule->y)) || (!rule->greater && (this->width == rule->x && this->height == rule->y))) { - DEBUG_INFO("Matched downsample rule %d", rule->id); - this->downsampleLevel = rule->level; - this->targetWidth >>= rule->level; - this->targetHeight >>= rule->level; - break; + match = rule; } } + if (match) + { + DEBUG_INFO("Matched downsample rule %d", rule->id); + this->downsampleLevel = match->level; + this->targetWidth >>= match->level; + this->targetHeight >>= match->level; + } + DEBUG_INFO("Request Size : %u x %u", this->targetWidth, this->targetHeight); const char * copyBackend = option_get_string("dxgi", "copyBackend");