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 |