Try to prevent invalid aspectRatio of SurfaceView

If the video's hieght is 0, the aspectRatio is set to Float.NaN which can cause further issues. Do not assign invalid values for the aspectRatio.
This commit is contained in:
TobiGr 2025-12-26 23:49:30 +01:00 committed by tobigr
parent 07d4ed5735
commit 9e00f5f480

View file

@ -100,7 +100,7 @@ public class ExpandableSurfaceView extends SurfaceView {
}
public void setAspectRatio(final float aspectRatio) {
if (videoAspectRatio == aspectRatio) {
if (videoAspectRatio == aspectRatio || aspectRatio == 0 || !Float.isFinite(aspectRatio)) {
return;
}