Index: content/browser/renderer_host/media/video_capture_manager.cc |
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc |
index c5b56cea4fe37a2491dd0ce19afd1d2702a22862..4ab3f47c3b806916c8e463afaafa4be0e201b243 100644 |
--- a/content/browser/renderer_host/media/video_capture_manager.cc |
+++ b/content/browser/renderer_host/media/video_capture_manager.cc |
@@ -227,20 +227,14 @@ void VideoCaptureManager::EnumerateDevices( |
// Bind a callback to ConsolidateDevicesInfoOnDeviceThread() with an argument |
// for another callback to OnDevicesInfoEnumerated() to be run in the current |
// loop, i.e. IO loop. Pass a timer for UMA histogram collection. |
- base::Callback<void(std::unique_ptr<VideoCaptureDeviceDescriptors>)> |
- devices_enumerated_callback = base::Bind( |
- &VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread, this, |
- media::BindToCurrentLoop(base::Bind( |
- &VideoCaptureManager::OnDevicesInfoEnumerated, this, |
- base::Owned(new base::ElapsedTimer()), client_callback)), |
- devices_info_cache_); |
- // OK to use base::Unretained() since we own the VCDFactory and |this| is |
- // bound in |devices_enumerated_callback|. |
device_task_runner_->PostTask( |
FROM_HERE, |
- base::Bind(&media::VideoCaptureDeviceFactory::EnumerateDeviceDescriptors, |
- base::Unretained(video_capture_device_factory_.get()), |
- devices_enumerated_callback)); |
+ base::Bind(&VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread, |
chfremer
2017/04/07 16:34:21
As a heads up, I am sorry about the extra work thi
Chandan
2017/04/10 09:18:24
Done.
|
+ this, |
+ media::BindToCurrentLoop(base::Bind( |
+ &VideoCaptureManager::OnDevicesInfoEnumerated, this, |
+ base::Owned(new base::ElapsedTimer()), client_callback)), |
+ devices_info_cache_)); |
} |
const media::VideoCaptureDeviceDescriptor* |
@@ -773,27 +767,27 @@ void VideoCaptureManager::OnDevicesInfoEnumerated( |
void VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread( |
chfremer
2017/04/07 16:34:21
Now that this method includes the logic for pullin
Chandan
2017/04/10 09:18:24
This method no longer exists in this class.
|
base::Callback<void(const VideoCaptureManager::DeviceInfos&)> |
on_devices_enumerated_callback, |
- const VideoCaptureManager::DeviceInfos& old_device_info_cache, |
- std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors_snapshot) { |
+ const VideoCaptureManager::DeviceInfos& old_device_info_cache) { |
DCHECK(device_task_runner_->BelongsToCurrentThread()); |
+ media::VideoCaptureDeviceDescriptors descriptors; |
+ video_capture_device_factory_->GetDeviceDescriptors(&descriptors); |
// Construct |new_devices_info_cache| with the cached devices that are still |
// present in the system, and remove their names from |names_snapshot|, so we |
// keep there the truly new devices. |
VideoCaptureManager::DeviceInfos new_devices_info_cache; |
for (const auto& device_info : old_device_info_cache) { |
- for (VideoCaptureDeviceDescriptors::iterator it = |
- descriptors_snapshot->begin(); |
- it != descriptors_snapshot->end(); ++it) { |
+ for (VideoCaptureDeviceDescriptors::iterator it = descriptors.begin(); |
+ it != descriptors.end(); ++it) { |
if (device_info.descriptor.device_id == it->device_id) { |
new_devices_info_cache.push_back(device_info); |
- descriptors_snapshot->erase(it); |
+ descriptors.erase(it); |
break; |
} |
} |
} |
// Get the device info for the new devices in |names_snapshot|. |
- for (const auto& it : *descriptors_snapshot) { |
+ for (const auto& it : descriptors) { |
DeviceInfo device_info(it); |
video_capture_device_factory_->GetSupportedFormats( |
it, &device_info.supported_formats); |