From 8d9b1cec8703718909601785522126572a032c06 Mon Sep 17 00:00:00 2001 From: Ruwen Hahn Date: Thu, 17 Aug 2023 19:07:58 +0200 Subject: [PATCH] simulcast: Use canvas resolution as upper limit for scaled pixel count This allows using a 1920x1080 request with e.g. a 1280x720 canvas --- plugins/simulcast/src/simulcast-output.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/simulcast/src/simulcast-output.cpp b/plugins/simulcast/src/simulcast-output.cpp index c58aa5e3a285e7..69195fac35d0ab 100644 --- a/plugins/simulcast/src/simulcast-output.cpp +++ b/plugins/simulcast/src/simulcast-output.cpp @@ -98,7 +98,8 @@ static pixel_resolution scale_resolution(const obs_video_info &ovi, auto base_pixels = static_cast(ovi.base_width) * ovi.base_height; - auto requested_pixels = requested_width * requested_height; + auto requested_pixels = + std::min(requested_width * requested_height, base_pixels); auto pixel_ratio = std::min( requested_pixels / static_cast(base_pixels), 1.0);