| 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 310c8f8ba844aacc3efad9da0009807ee13bd6b4..dcd83e0d574d1794db37f24b2b98c0dd6494f038 100644
|
| --- a/content/browser/renderer_host/media/video_capture_manager.cc
|
| +++ b/content/browser/renderer_host/media/video_capture_manager.cc
|
| @@ -281,7 +281,7 @@ void VideoCaptureManager::EnumerateDevices(MediaStreamType stream_type) {
|
| // 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<VideoCaptureDevice::Names>)>
|
| + base::Callback<void(std::unique_ptr<VideoCaptureDeviceDescriptors>)>
|
| devices_enumerated_callback = base::Bind(
|
| &VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread, this,
|
| media::BindToCurrentLoop(
|
| @@ -290,8 +290,9 @@ void VideoCaptureManager::EnumerateDevices(MediaStreamType stream_type) {
|
| stream_type, 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::EnumerateDeviceNames,
|
| + device_task_runner_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&media::VideoCaptureDeviceFactory::EnumerateDeviceDescriptors,
|
| base::Unretained(video_capture_device_factory_.get()),
|
| devices_enumerated_callback));
|
| }
|
| @@ -432,14 +433,15 @@ void VideoCaptureManager::HandleQueuedStartRequest() {
|
| // held in the browser-side VideoCaptureDevice::Name structure.
|
| const media::VideoCaptureDeviceInfo* found = GetDeviceInfoById(entry->id);
|
| if (found) {
|
| - entry->video_capture_controller()->DoLogOnIOThread(base::StringPrintf(
|
| - "Starting device: id: %s, name: %s, api: %s",
|
| - found->name.id().c_str(), found->name.GetNameAndModel().c_str(),
|
| - found->name.GetCaptureApiTypeString()));
|
| + entry->video_capture_controller()->DoLogOnIOThread(
|
| + base::StringPrintf("Starting device: id: %s, name: %s, api: %s",
|
| + found->descriptor.device_id.c_str(),
|
| + found->GetNameAndModel().c_str(),
|
| + found->descriptor.GetCaptureApiTypeString()));
|
|
|
| start_capture_function = base::Bind(
|
| &VideoCaptureManager::DoStartDeviceCaptureOnDeviceThread, this,
|
| - found->name, request->params(),
|
| + found->descriptor, request->params(),
|
| base::Passed(entry->video_capture_controller()->NewDeviceClient()));
|
| } else {
|
| // Errors from DoStartDeviceCaptureOnDeviceThread go via
|
| @@ -524,14 +526,14 @@ void VideoCaptureManager::OnDeviceStarted(
|
|
|
| std::unique_ptr<media::VideoCaptureDevice>
|
| VideoCaptureManager::DoStartDeviceCaptureOnDeviceThread(
|
| - const VideoCaptureDevice::Name& name,
|
| + const VideoCaptureDeviceDescriptor& descriptor,
|
| const media::VideoCaptureParams& params,
|
| std::unique_ptr<VideoCaptureDevice::Client> device_client) {
|
| SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime");
|
| DCHECK(IsOnDeviceThread());
|
|
|
| std::unique_ptr<VideoCaptureDevice> video_capture_device;
|
| - video_capture_device = video_capture_device_factory_->Create(name);
|
| + video_capture_device = video_capture_device_factory_->Create(descriptor);
|
|
|
| if (!video_capture_device) {
|
| device_client->OnError(FROM_HERE, "Could not create capture device");
|
| @@ -925,8 +927,8 @@ void VideoCaptureManager::OnDevicesInfoEnumerated(
|
| // StreamDeviceInfo for return purposes.
|
| StreamDeviceInfoArray devices;
|
| for (const auto& it : devices_info_cache_) {
|
| - devices.push_back(StreamDeviceInfo(
|
| - stream_type, it.name.GetNameAndModel(), it.name.id()));
|
| + devices.emplace_back(stream_type, it.GetNameAndModel(),
|
| + it.descriptor.device_id);
|
| }
|
| listener_->DevicesEnumerated(stream_type, devices);
|
| }
|
| @@ -940,28 +942,28 @@ void VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread(
|
| on_devices_enumerated_callback,
|
| MediaStreamType stream_type,
|
| const media::VideoCaptureDeviceInfos& old_device_info_cache,
|
| - std::unique_ptr<VideoCaptureDevice::Names> names_snapshot) {
|
| + std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors_snapshot) {
|
| DCHECK(IsOnDeviceThread());
|
| // 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.
|
| media::VideoCaptureDeviceInfos new_devices_info_cache;
|
| for (const auto& device_info : old_device_info_cache) {
|
| - for (VideoCaptureDevice::Names::iterator it = names_snapshot->begin();
|
| - it != names_snapshot->end(); ++it) {
|
| - if (device_info.name.id() == it->id()) {
|
| + for (VideoCaptureDeviceDescriptors::iterator it =
|
| + descriptors_snapshot->begin();
|
| + it != descriptors_snapshot->end(); ++it) {
|
| + if (device_info.descriptor.device_id == it->device_id) {
|
| new_devices_info_cache.push_back(device_info);
|
| - names_snapshot->erase(it);
|
| + descriptors_snapshot->erase(it);
|
| break;
|
| }
|
| }
|
| }
|
|
|
| - // Get the supported capture formats for the new devices in |names_snapshot|.
|
| - for (const auto& it : *names_snapshot) {
|
| - media::VideoCaptureDeviceInfo device_info(it, media::VideoCaptureFormats());
|
| - video_capture_device_factory_->GetDeviceSupportedFormats(
|
| - it, &(device_info.supported_formats));
|
| + // Get the device info for the new devices in |names_snapshot|.
|
| + for (const auto& it : *descriptors_snapshot) {
|
| + media::VideoCaptureDeviceInfo device_info;
|
| + video_capture_device_factory_->GetDeviceInfo(it, &device_info);
|
| ConsolidateCaptureFormats(&device_info.supported_formats);
|
| new_devices_info_cache.push_back(device_info);
|
| }
|
| @@ -1044,7 +1046,7 @@ VideoCaptureManager::DeviceEntry* VideoCaptureManager::GetDeviceEntryBySerialId(
|
| media::VideoCaptureDeviceInfo* VideoCaptureManager::GetDeviceInfoById(
|
| const std::string& id) {
|
| for (auto& it : devices_info_cache_) {
|
| - if (it.name.id() == id)
|
| + if (it.descriptor.device_id == id)
|
| return ⁢
|
| }
|
| return nullptr;
|
|
|