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

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: 80-char line fix in test html. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 "content/browser/renderer_host/media/video_capture_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1088
1089 // Walk the |devices_info_cache_| and produce a 1089 // Walk the |devices_info_cache_| and produce a
1090 // media::VideoCaptureDeviceDescriptors for return purposes. 1090 // media::VideoCaptureDeviceDescriptors for return purposes.
1091 media::VideoCaptureDeviceDescriptors devices; 1091 media::VideoCaptureDeviceDescriptors devices;
1092 std::vector<std::tuple<media::VideoCaptureDeviceDescriptor, 1092 std::vector<std::tuple<media::VideoCaptureDeviceDescriptor,
1093 media::VideoCaptureFormats>> 1093 media::VideoCaptureFormats>>
1094 descriptors_and_formats; 1094 descriptors_and_formats;
1095 for (const auto& it : devices_info_cache_) { 1095 for (const auto& it : devices_info_cache_) {
1096 devices.emplace_back(it.descriptor); 1096 devices.emplace_back(it.descriptor);
1097 descriptors_and_formats.emplace_back(it.descriptor, it.supported_formats); 1097 descriptors_and_formats.emplace_back(it.descriptor, it.supported_formats);
1098 }
1099
1100 if (!descriptors_and_formats.empty()) {
1098 MediaInternals::GetInstance()->UpdateVideoCaptureDeviceCapabilities( 1101 MediaInternals::GetInstance()->UpdateVideoCaptureDeviceCapabilities(
1099 descriptors_and_formats); 1102 descriptors_and_formats);
1100 } 1103 }
1101 1104
1102 client_callback.Run(devices); 1105 client_callback.Run(devices);
1103 } 1106 }
1104 1107
1105 bool VideoCaptureManager::IsOnDeviceThread() const { 1108 bool VideoCaptureManager::IsOnDeviceThread() const {
1106 return device_task_runner_->BelongsToCurrentThread(); 1109 return device_task_runner_->BelongsToCurrentThread();
1107 } 1110 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 VideoCaptureDevice::TakePhotoCallback callback, 1287 VideoCaptureDevice::TakePhotoCallback callback,
1285 VideoCaptureDevice* device) { 1288 VideoCaptureDevice* device) {
1286 // Unretained() is safe to use here because |device| would be null if it 1289 // Unretained() is safe to use here because |device| would be null if it
1287 // was scheduled for shutdown and destruction, and because this task is 1290 // was scheduled for shutdown and destruction, and because this task is
1288 // guaranteed to run before the task that destroys the |device|. 1291 // guaranteed to run before the task that destroys the |device|.
1289 device_task_runner_->PostTask( 1292 device_task_runner_->PostTask(
1290 FROM_HERE, base::Bind(&VideoCaptureDevice::TakePhoto, 1293 FROM_HERE, base::Bind(&VideoCaptureDevice::TakePhoto,
1291 base::Unretained(device), base::Passed(&callback))); 1294 base::Unretained(device), base::Passed(&callback)));
1292 } 1295 }
1293 1296
1297 base::Optional<CameraCalibration> VideoCaptureManager::GetCameraCalibration(
1298 const std::string& device_id) {
1299 VideoCaptureManager::DeviceInfo* info = GetDeviceInfoById(device_id);
1300 if (!info)
1301 return base::Optional<CameraCalibration>();
1302 return info->descriptor.camera_calibration;
1303 }
1304
1294 #if defined(OS_ANDROID) 1305 #if defined(OS_ANDROID)
1295 void VideoCaptureManager::OnApplicationStateChange( 1306 void VideoCaptureManager::OnApplicationStateChange(
1296 base::android::ApplicationState state) { 1307 base::android::ApplicationState state) {
1297 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1308 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1298 1309
1299 // Only release/resume devices when the Application state changes from 1310 // Only release/resume devices when the Application state changes from
1300 // RUNNING->STOPPED->RUNNING. 1311 // RUNNING->STOPPED->RUNNING.
1301 if (state == base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES && 1312 if (state == base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES &&
1302 !application_state_has_running_activities_) { 1313 !application_state_has_running_activities_) {
1303 ResumeDevices(); 1314 ResumeDevices();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 if (!device_in_queue) { 1353 if (!device_in_queue) {
1343 // Session ID is only valid for Screen capture. So we can fake it to 1354 // Session ID is only valid for Screen capture. So we can fake it to
1344 // resume video capture devices here. 1355 // resume video capture devices here.
1345 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1356 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1346 } 1357 }
1347 } 1358 }
1348 } 1359 }
1349 #endif // defined(OS_ANDROID) 1360 #endif // defined(OS_ANDROID)
1350 1361
1351 } // namespace content 1362 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698