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: review #25 fix. Thanks kinuko@. Created 3 years, 11 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1067
1068 // Walk the |devices_info_cache_| and produce a 1068 // Walk the |devices_info_cache_| and produce a
1069 // media::VideoCaptureDeviceDescriptors for return purposes. 1069 // media::VideoCaptureDeviceDescriptors for return purposes.
1070 media::VideoCaptureDeviceDescriptors devices; 1070 media::VideoCaptureDeviceDescriptors devices;
1071 std::vector<std::tuple<media::VideoCaptureDeviceDescriptor, 1071 std::vector<std::tuple<media::VideoCaptureDeviceDescriptor,
1072 media::VideoCaptureFormats>> 1072 media::VideoCaptureFormats>>
1073 descriptors_and_formats; 1073 descriptors_and_formats;
1074 for (const auto& it : devices_info_cache_) { 1074 for (const auto& it : devices_info_cache_) {
1075 devices.emplace_back(it.descriptor); 1075 devices.emplace_back(it.descriptor);
1076 descriptors_and_formats.emplace_back(it.descriptor, it.supported_formats); 1076 descriptors_and_formats.emplace_back(it.descriptor, it.supported_formats);
1077 }
1078
1079 if (!descriptors_and_formats.empty()) {
1077 MediaInternals::GetInstance()->UpdateVideoCaptureDeviceCapabilities( 1080 MediaInternals::GetInstance()->UpdateVideoCaptureDeviceCapabilities(
1078 descriptors_and_formats); 1081 descriptors_and_formats);
1079 } 1082 }
1080 1083
1081 client_callback.Run(devices); 1084 client_callback.Run(devices);
1082 } 1085 }
1083 1086
1084 bool VideoCaptureManager::IsOnDeviceThread() const { 1087 bool VideoCaptureManager::IsOnDeviceThread() const {
1085 return device_task_runner_->BelongsToCurrentThread(); 1088 return device_task_runner_->BelongsToCurrentThread();
1086 } 1089 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 VideoCaptureDevice::TakePhotoCallback callback, 1266 VideoCaptureDevice::TakePhotoCallback callback,
1264 VideoCaptureDevice* device) { 1267 VideoCaptureDevice* device) {
1265 // Unretained() is safe to use here because |device| would be null if it 1268 // Unretained() is safe to use here because |device| would be null if it
1266 // was scheduled for shutdown and destruction, and because this task is 1269 // was scheduled for shutdown and destruction, and because this task is
1267 // guaranteed to run before the task that destroys the |device|. 1270 // guaranteed to run before the task that destroys the |device|.
1268 device_task_runner_->PostTask( 1271 device_task_runner_->PostTask(
1269 FROM_HERE, base::Bind(&VideoCaptureDevice::TakePhoto, 1272 FROM_HERE, base::Bind(&VideoCaptureDevice::TakePhoto,
1270 base::Unretained(device), base::Passed(&callback))); 1273 base::Unretained(device), base::Passed(&callback)));
1271 } 1274 }
1272 1275
1276 base::Optional<CameraCalibration> VideoCaptureManager::GetCameraCalibration(
1277 const std::string& device_id) {
1278 VideoCaptureManager::DeviceInfo* info = GetDeviceInfoById(device_id);
1279 if (!info)
1280 return base::Optional<CameraCalibration>();
1281 return info->descriptor.camera_calibration;
1282 }
1283
1273 #if defined(OS_ANDROID) 1284 #if defined(OS_ANDROID)
1274 void VideoCaptureManager::OnApplicationStateChange( 1285 void VideoCaptureManager::OnApplicationStateChange(
1275 base::android::ApplicationState state) { 1286 base::android::ApplicationState state) {
1276 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1287 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1277 1288
1278 // Only release/resume devices when the Application state changes from 1289 // Only release/resume devices when the Application state changes from
1279 // RUNNING->STOPPED->RUNNING. 1290 // RUNNING->STOPPED->RUNNING.
1280 if (state == base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES && 1291 if (state == base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES &&
1281 !application_state_has_running_activities_) { 1292 !application_state_has_running_activities_) {
1282 ResumeDevices(); 1293 ResumeDevices();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 if (!device_in_queue) { 1332 if (!device_in_queue) {
1322 // Session ID is only valid for Screen capture. So we can fake it to 1333 // Session ID is only valid for Screen capture. So we can fake it to
1323 // resume video capture devices here. 1334 // resume video capture devices here.
1324 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1335 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1325 } 1336 }
1326 } 1337 }
1327 } 1338 }
1328 #endif // defined(OS_ANDROID) 1339 #endif // defined(OS_ANDROID)
1329 1340
1330 } // namespace content 1341 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698