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

Unified Diff: content/browser/renderer_host/media/media_stream_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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/media_stream_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index 029b0638c4e3ced5da47532ccb1c32e5b6504b51..86ce133bd3a006ac231a1124d3dd16d6cf289576 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -207,17 +207,6 @@ MediaDeviceType ConvertToMediaDeviceType(MediaStreamType stream_type) {
return NUM_MEDIA_DEVICE_TYPES;
}
-MediaStreamDevices ConvertToMediaStreamDevices(
- MediaStreamType stream_type,
- const MediaDeviceInfoArray& device_infos) {
- MediaStreamDevices devices;
- for (const auto& info : device_infos) {
- devices.emplace_back(stream_type, info.device_id, info.label);
- }
-
- return devices;
-}
-
} // namespace
@@ -945,13 +934,12 @@ void MediaStreamManager::PostRequestToUI(
if (!fake_ui_)
fake_ui_.reset(new FakeMediaStreamUIProxy());
- MediaStreamDevices devices;
- for (const auto& info : enumeration[MEDIA_DEVICE_TYPE_AUDIO_INPUT]) {
- devices.emplace_back(audio_type, info.device_id, info.label);
- }
- for (const auto& info : enumeration[MEDIA_DEVICE_TYPE_VIDEO_INPUT]) {
- devices.emplace_back(video_type, info.device_id, info.label);
- }
+ MediaStreamDevices devices = ConvertToMediaStreamDevices(
+ request->audio_type(), enumeration[MEDIA_DEVICE_TYPE_AUDIO_INPUT]);
+ MediaStreamDevices video_devices = ConvertToMediaStreamDevices(
+ request->video_type(), enumeration[MEDIA_DEVICE_TYPE_VIDEO_INPUT]);
+ devices.reserve(devices.size() + video_devices.size());
+ devices.insert(devices.end(), video_devices.begin(), video_devices.end());
fake_ui_->SetAvailableDevices(devices);
@@ -1749,4 +1737,21 @@ void MediaStreamManager::FlushVideoCaptureThreadForTesting() {
}
#endif
+MediaStreamDevices MediaStreamManager::ConvertToMediaStreamDevices(
+ MediaStreamType stream_type,
+ const MediaDeviceInfoArray& device_infos) {
+ MediaStreamDevices devices;
+ for (const auto& info : device_infos)
+ devices.emplace_back(stream_type, info.device_id, info.label);
+
+ if (stream_type != MEDIA_DEVICE_VIDEO_CAPTURE)
+ return devices;
+
+ for (auto& device : devices) {
+ device.camera_calibration =
+ video_capture_manager()->GetCameraCalibration(device.id);
+ }
+ return devices;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698