Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java

Issue 2482983002: MediaSettingsRange: s/long/double/ in MediaSettingsRange.idl and PhotoCapabilities.idl (Closed)
Patch Set: s/float/double/ in fake_video_capture_device.* Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
diff --git a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
index ce5785ea0935c16bfa79b480360bddc2efb460ea..e43a4dfd33ae31975df73510ed85d12c838c7ba7 100644
--- a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
+++ b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
@@ -365,9 +365,8 @@ public abstract class VideoCaptureCamera
int minZoom = 0;
int stepZoom = 0;
if (parameters.isZoomSupported()) {
- // The Max zoom is returned as x100 by the API to avoid using floating point.
maxZoom = parameters.getZoomRatios().get(parameters.getMaxZoom());
- currentZoom = 100 + 100 * parameters.getZoom();
+ currentZoom = parameters.getZoomRatios().get(parameters.getZoom());
minZoom = parameters.getZoomRatios().get(0);
if (parameters.getZoomRatios().size() > 1) {
stepZoom = parameters.getZoomRatios().get(1) - parameters.getZoomRatios().get(0);
@@ -407,13 +406,10 @@ public abstract class VideoCaptureCamera
builder.setExposureMode(jniExposureMode);
final float step = parameters.getExposureCompensationStep();
- builder.setMinExposureCompensation(
- Math.round(parameters.getMinExposureCompensation() * step * 100));
- builder.setMaxExposureCompensation(
- Math.round(parameters.getMaxExposureCompensation() * step * 100));
- builder.setCurrentExposureCompensation(
- Math.round(parameters.getExposureCompensation() * step * 100));
- builder.setStepExposureCompensation(Math.round(step * 100));
+ builder.setStepExposureCompensation(step);
+ builder.setMinExposureCompensation(parameters.getMinExposureCompensation() * step);
+ builder.setMaxExposureCompensation(parameters.getMaxExposureCompensation() * step);
+ builder.setCurrentExposureCompensation(parameters.getExposureCompensation() * step);
int jniWhiteBalanceMode = AndroidMeteringMode.NONE;
if (parameters.isAutoWhiteBalanceLockSupported()
@@ -462,10 +458,11 @@ public abstract class VideoCaptureCamera
}
@Override
- public void setPhotoOptions(int zoom, int focusMode, int exposureMode, int width, int height,
- float[] pointsOfInterest2D, boolean hasExposureCompensation, int exposureCompensation,
- int whiteBalanceMode, int iso, boolean hasRedEyeReduction, boolean redEyeReduction,
- int fillLightMode, int colorTemperature) {
+ public void setPhotoOptions(double zoom, int focusMode, int exposureMode, double width,
+ double height, float[] pointsOfInterest2D, boolean hasExposureCompensation,
+ double exposureCompensation, int whiteBalanceMode, double iso,
+ boolean hasRedEyeReduction, boolean redEyeReduction, int fillLightMode,
+ double colorTemperature) {
android.hardware.Camera.Parameters parameters = getCameraParameters(mCamera);
if (parameters.isZoomSupported() && zoom > 0) {
@@ -496,8 +493,8 @@ public abstract class VideoCaptureCamera
parameters.setAutoExposureLock(false);
}
}
- if (width > 0) mPhotoWidth = width;
- if (height > 0) mPhotoHeight = height;
+ if (width > 0) mPhotoWidth = (int) Math.round(width);
+ if (height > 0) mPhotoHeight = (int) Math.round(height);
// Upon new |zoom| configuration, clear up the previous |mAreaOfInterest| if any.
if (mAreaOfInterest != null && !mAreaOfInterest.rect.isEmpty() && zoom > 0) {
@@ -537,8 +534,8 @@ public abstract class VideoCaptureCamera
}
if (hasExposureCompensation) {
- final int unnormalizedExposureCompensation = Math.round(
- exposureCompensation / 100.0f / parameters.getExposureCompensationStep());
+ final int unnormalizedExposureCompensation = (int) Math.round(
+ exposureCompensation / parameters.getExposureCompensationStep());
parameters.setExposureCompensation(unnormalizedExposureCompensation);
}
@@ -553,8 +550,8 @@ public abstract class VideoCaptureCamera
} else if (whiteBalanceMode == AndroidMeteringMode.FIXED
&& parameters.isAutoWhiteBalanceLockSupported()) {
parameters.setAutoWhiteBalanceLock(true);
- if (colorTemperature > 0) {
- final String closestSetting = getClosestWhiteBalance(colorTemperature);
+ if (colorTemperature > 0.0) {
+ final String closestSetting = getClosestWhiteBalance((int) colorTemperature);
if (closestSetting != null) parameters.setWhiteBalance(closestSetting);
}
}

Powered by Google App Engine
This is Rietveld 408576698