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

Unified Diff: media/capture/video/android/video_capture_device_android.cc

Issue 2164473002: ImageCapture: wire PhotoCapabilities' ISO, width, height and PhotoSettings' width and height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: foolip@ comments. Rebase Created 4 years, 5 months 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/video_capture_device_android.cc
diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc
index 35e12ae0c493ae34f8c8c51d26f81b92bcef71cc..d229c9dc9fad099c62b2601d43b58cfe6dad3f68 100644
--- a/media/capture/video/android/video_capture_device_android.cc
+++ b/media/capture/video/android/video_capture_device_android.cc
@@ -150,7 +150,9 @@ void VideoCaptureDeviceAndroid::TakePhoto(TakePhotoCallback callback) {
std::unique_ptr<TakePhotoCallback> heap_callback(
new TakePhotoCallback(std::move(callback)));
const intptr_t callback_id = reinterpret_cast<intptr_t>(heap_callback.get());
- if (!Java_VideoCapture_takePhoto(env, j_capture_.obj(), callback_id))
+ if (!Java_VideoCapture_takePhoto(env, j_capture_.obj(), callback_id,
+ next_photo_resolution_.width(),
+ next_photo_resolution_.height()))
return;
{
@@ -170,6 +172,18 @@ void VideoCaptureDeviceAndroid::GetPhotoCapabilities(
// PhotoCapabilities to mojom::PhotoCapabilitiesPtr, https://crbug.com/622002.
mojom::PhotoCapabilitiesPtr photo_capabilities =
mojom::PhotoCapabilities::New();
+ photo_capabilities->iso = mojom::Range::New();
+ photo_capabilities->iso->current = caps.getCurrentIso();
+ photo_capabilities->iso->max = caps.getMaxIso();
+ photo_capabilities->iso->min = caps.getMinIso();
+ photo_capabilities->height = mojom::Range::New();
+ photo_capabilities->height->current = caps.getCurrentHeight();
+ photo_capabilities->height->max = caps.getMaxHeight();
+ photo_capabilities->height->min = caps.getMinHeight();
+ photo_capabilities->width = mojom::Range::New();
+ photo_capabilities->width->current = caps.getCurrentWidth();
+ photo_capabilities->width->max = caps.getMaxWidth();
+ photo_capabilities->width->min = caps.getMinWidth();
photo_capabilities->zoom = mojom::Range::New();
photo_capabilities->zoom->current = caps.getCurrentZoom();
photo_capabilities->zoom->max = caps.getMaxZoom();
@@ -184,6 +198,14 @@ void VideoCaptureDeviceAndroid::SetPhotoOptions(
mojom::PhotoSettingsPtr settings,
SetPhotoOptionsCallback callback) {
JNIEnv* env = AttachCurrentThread();
+ // |width| and/or |height| are kept for the next TakePhoto()s.
+ if (settings->has_width || settings->has_height)
+ next_photo_resolution_.SetSize(0, 0);
+ if (settings->has_width)
+ next_photo_resolution_.set_width(settings->width);
dcheng 2016/07/22 04:45:29 What happens if settings->width overflows int?
mcasas 2016/07/22 16:46:32 gfx::Size::set_{width,height}() clamps negative nu
dcheng 2016/07/22 18:07:23 Right, it just ... seems a bit odd. I suppose we
mcasas 2016/07/22 23:16:27 Using base::saturated_cast<int>() now. (Note that
+ if (settings->has_height)
+ next_photo_resolution_.set_height(settings->height);
+
if (settings->has_zoom)
Java_VideoCapture_setZoom(env, j_capture_.obj(), settings->zoom);
callback.Run(true);

Powered by Google App Engine
This is Rietveld 408576698