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); |