mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
If camera fails to support its supported and chosen preview mode, use its actual setting
git-svn-id: https://zxing.googlecode.com/svn/trunk@2863 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
4e1a2acf82
commit
e4432a0991
|
@ -131,6 +131,15 @@ final class CameraConfigurationManager {
|
|||
|
||||
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
|
||||
camera.setParameters(parameters);
|
||||
|
||||
Camera.Parameters afterParameters = camera.getParameters();
|
||||
Camera.Size afterSize = afterParameters.getPreviewSize();
|
||||
if (afterSize!= null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
|
||||
Log.w(TAG, "Camera said it supported preview size " + cameraResolution.x + 'x' + cameraResolution.y +
|
||||
", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height);
|
||||
cameraResolution.x = afterSize.width;
|
||||
cameraResolution.y = afterSize.height;
|
||||
}
|
||||
}
|
||||
|
||||
Point getCameraResolution() {
|
||||
|
|
Loading…
Reference in a new issue