Skip to content

Commit

Permalink
add sanity checks to prepareVideoEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Oct 14, 2024
1 parent 546ef08 commit 6d0f6cb
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6d0f6cb

Please sign in to comment.