diff --git a/encoder/src/main/java/com/pedro/encoder/video/VideoEncoder.java b/encoder/src/main/java/com/pedro/encoder/video/VideoEncoder.java index 9313970d7..e2c0cde44 100644 --- a/encoder/src/main/java/com/pedro/encoder/video/VideoEncoder.java +++ b/encoder/src/main/java/com/pedro/encoder/video/VideoEncoder.java @@ -94,6 +94,15 @@ public boolean prepareVideoEncoder(int width, int height, int fps, int bitRate, int level) { if (prepared) stop(); + if (width % 2 != 0) { + throw new IllegalArgumentException("Invalid width: " + width + ", must be an even value"); + } + if (height % 2 != 0) { + throw new IllegalArgumentException("Invalid height: " + height + ", must be an even value"); + } + if (fps <= 0) { + throw new IllegalArgumentException("Invalid fps: " + fps + ", must be higher than 0"); + } this.width = width; this.height = height; this.fps = fps;