Reorder block

pull/741/head
Mattia Iavarone 6 years ago
parent de455f1850
commit 96f6a20f6c
  1. 9
      cameraview/src/main/java/com/otaliastudios/cameraview/internal/DeviceEncoders.java

@ -261,12 +261,10 @@ public class DeviceEncoders {
" Range:" + mVideoCapabilities.getSupportedHeights()); " Range:" + mVideoCapabilities.getSupportedHeights());
} }
// It's still possible that we're unsupported for other reasons.
if (!mVideoCapabilities.isSizeSupported(width, height)) {
try {
if (!mVideoCapabilities.getSupportedHeightsFor(width).contains(height)) {
// We cannot change the aspect ratio, but the max block count might also be the // We cannot change the aspect ratio, but the max block count might also be the
// issue. Try to find a width that contains a height that would accept our AR. // issue. Try to find a width that contains a height that would accept our AR.
try {
if (!mVideoCapabilities.getSupportedHeightsFor(width).contains(height)) {
int candidateWidth = width; int candidateWidth = width;
int minWidth = mVideoCapabilities.getSupportedWidths().getLower(); int minWidth = mVideoCapabilities.getSupportedWidths().getLower();
int widthAlignment = mVideoCapabilities.getWidthAlignment(); int widthAlignment = mVideoCapabilities.getWidthAlignment();
@ -284,6 +282,9 @@ public class DeviceEncoders {
} }
} }
} catch (IllegalArgumentException ignore) {} } catch (IllegalArgumentException ignore) {}
// It's still possible that we're unsupported for other reasons.
if (!mVideoCapabilities.isSizeSupported(width, height)) {
throw new VideoException("Size not supported for unknown reason." + throw new VideoException("Size not supported for unknown reason." +
" Might be an aspect ratio issue." + " Might be an aspect ratio issue." +
" Desired size:" + new Size(width, height)); " Desired size:" + new Size(width, height));

Loading…
Cancel
Save