| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/capture/video/fake_video_capture_device.h" | 5 #include "media/capture/video/fake_video_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 void FakeVideoCaptureDevice::GetPhotoCapabilities( | 181 void FakeVideoCaptureDevice::GetPhotoCapabilities( |
| 182 GetPhotoCapabilitiesCallback callback) { | 182 GetPhotoCapabilitiesCallback callback) { |
| 183 mojom::PhotoCapabilitiesPtr photo_capabilities = | 183 mojom::PhotoCapabilitiesPtr photo_capabilities = |
| 184 mojom::PhotoCapabilities::New(); | 184 mojom::PhotoCapabilities::New(); |
| 185 photo_capabilities->zoom = mojom::Range::New(); | 185 photo_capabilities->zoom = mojom::Range::New(); |
| 186 photo_capabilities->zoom->current = current_zoom_; | 186 photo_capabilities->zoom->current = current_zoom_; |
| 187 photo_capabilities->zoom->max = kMaxZoom; | 187 photo_capabilities->zoom->max = kMaxZoom; |
| 188 photo_capabilities->zoom->min = kMinZoom; | 188 photo_capabilities->zoom->min = kMinZoom; |
| 189 photo_capabilities->focus_mode = mojom::FocusMode::UNAVAILABLE; |
| 189 callback.Run(std::move(photo_capabilities)); | 190 callback.Run(std::move(photo_capabilities)); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void FakeVideoCaptureDevice::SetPhotoOptions(mojom::PhotoSettingsPtr settings, | 193 void FakeVideoCaptureDevice::SetPhotoOptions(mojom::PhotoSettingsPtr settings, |
| 193 SetPhotoOptionsCallback callback) { | 194 SetPhotoOptionsCallback callback) { |
| 194 if (settings->has_zoom) | 195 if (settings->has_zoom) |
| 195 current_zoom_ = std::max(kMinZoom, std::min(settings->zoom, kMaxZoom)); | 196 current_zoom_ = std::max(kMinZoom, std::min(settings->zoom, kMaxZoom)); |
| 196 callback.Run(true); | 197 callback.Run(true); |
| 197 } | 198 } |
| 198 | 199 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // Don't accumulate any debt if we are lagging behind - just post the next | 298 // Don't accumulate any debt if we are lagging behind - just post the next |
| 298 // frame immediately and continue as normal. | 299 // frame immediately and continue as normal. |
| 299 const base::TimeTicks next_execution_time = | 300 const base::TimeTicks next_execution_time = |
| 300 std::max(current_time, expected_execution_time + frame_interval); | 301 std::max(current_time, expected_execution_time + frame_interval); |
| 301 const base::TimeDelta delay = next_execution_time - current_time; | 302 const base::TimeDelta delay = next_execution_time - current_time; |
| 302 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 303 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 303 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); | 304 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); |
| 304 } | 305 } |
| 305 | 306 |
| 306 } // namespace media | 307 } // namespace media |
| OLD | NEW |