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) {