From 7106c7313335b9b7f4ff1ad76ae2e765adf48938 Mon Sep 17 00:00:00 2001 From: pedroSG94 Date: Tue, 20 Aug 2024 10:16:25 +0200 Subject: [PATCH] fix preview 1:1 --- .../main/java/com/pedro/encoder/utils/gl/SizeCalculator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoder/src/main/java/com/pedro/encoder/utils/gl/SizeCalculator.java b/encoder/src/main/java/com/pedro/encoder/utils/gl/SizeCalculator.java index be43d11cf..14e6d1e86 100644 --- a/encoder/src/main/java/com/pedro/encoder/utils/gl/SizeCalculator.java +++ b/encoder/src/main/java/com/pedro/encoder/utils/gl/SizeCalculator.java @@ -68,7 +68,7 @@ public static Pair getViewport(AspectRatioMode mode, int previewWi int xf = previewWidth; int yf = previewHeight; if ((previewAspectRatio > 1f && streamAspectRatio > previewAspectRatio) || - (streamAspectRatio < 1f && previewAspectRatio < 1 && streamAspectRatio > previewAspectRatio) || + (streamAspectRatio <= 1f && previewAspectRatio <= 1 && streamAspectRatio > previewAspectRatio) || (streamAspectRatio > 1f && previewAspectRatio < 1f)) { if (mode == AspectRatioMode.Adjust) { yf = streamHeight * previewWidth / streamWidth; @@ -77,7 +77,7 @@ public static Pair getViewport(AspectRatioMode mode, int previewWi xf = streamWidth * previewHeight / streamHeight; xo = (xf - previewWidth) / -2; } - } else if ((streamAspectRatio > 1f && previewAspectRatio > 1f && streamAspectRatio < previewAspectRatio) || + } else if ((streamAspectRatio >= 1f && previewAspectRatio >= 1f && streamAspectRatio < previewAspectRatio) || (previewAspectRatio < 1f && streamAspectRatio < previewAspectRatio) || (streamAspectRatio < 1f && previewAspectRatio > 1f)) { if (mode == AspectRatioMode.Adjust) {