Chromium Code Reviews| 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 feb556df2267d56df7cdcf365e6aca857265ce77..56f5230c5e75ed748d53ef2694dc3f00e188aaa8 100644 |
| --- a/content/browser/renderer_host/media/video_capture_manager.cc |
| +++ b/content/browser/renderer_host/media/video_capture_manager.cc |
| @@ -150,6 +150,12 @@ void VideoCaptureManager::DoStartDeviceOnDeviceThread( |
| video_capture_device.reset(use_fake_device_ ? |
| media::FakeVideoCaptureDevice::Create(*found) : |
| media::VideoCaptureDevice::Create(*found)); |
| + |
| + // Filter capture capabilities: remove all except the current one. |
| + media::VideoCaptureCapabilities& formats = |
|
perkj_chrome
2013/10/23 13:19:45
What happen after the camera has been stopped? The
|
| + video_capture_capabilities_[entry->id]; |
| + formats.clear(); |
| + formats.push_back(capture_params); |
| } |
| break; |
| } |
| @@ -252,6 +258,19 @@ void VideoCaptureManager::StopCaptureForClient( |
| DestroyDeviceEntryIfNoClients(entry); |
| } |
| +const media::VideoCaptureCapabilities* |
| +VideoCaptureManager::EnumerateDeviceCapabilities( |
| + const StreamDeviceInfo& device_info) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
|
perkj_chrome
2013/10/23 13:19:45
What is the plan when it comes to multiple opening
perkj_chrome
2013/10/23 13:19:45
So this is done on the IO thread but you modify |v
|
| + |
| + // Find the device we are looking for and return its associated capabilities. |
| + std::map<std::string, media::VideoCaptureCapabilities>::iterator it = |
| + video_capture_capabilities_.find(device_info.device.id); |
| + if ( it != video_capture_capabilities_.end()) |
| + return &(it->second); |
| + return NULL; |
| +} |
| + |
| void VideoCaptureManager::DoStopDeviceOnDeviceThread(DeviceEntry* entry) { |
| SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StopDeviceTime"); |
| DCHECK(IsOnDeviceThread()); |
| @@ -321,8 +340,21 @@ VideoCaptureManager::GetAvailableDevicesOnDeviceThread( |
| // enumerate the devices again. |
| if (!use_fake_device_) { |
| media::VideoCaptureDevice::GetDeviceNames(&result); |
| + // Add to the cache the devices' supported capture formats. |
| + media::VideoCaptureDevice::Names::iterator name_it; |
|
perkj_chrome
2013/10/23 13:19:45
See how GetAvailableDevicesOnDeviceThread is used
|
| + for (name_it = result.begin(); name_it != result.end(); ++name_it) { |
| + media::VideoCaptureDevice::GetDeviceSupportedFormats( |
| + *name_it, &video_capture_capabilities_[name_it->id()] ); |
| + } |
| } else { |
| media::FakeVideoCaptureDevice::GetDeviceNames(&result); |
| + // Add to the cache the devices' supported capture formats. |
| + media::VideoCaptureDevice::Names::iterator name_it; |
| + media::VideoCaptureCapabilities formats; |
| + for (name_it = result.begin(); name_it != result.end(); ++name_it) { |
| + media::FakeVideoCaptureDevice::GetDeviceSupportedFormats( |
| + *name_it, &video_capture_capabilities_[name_it->id()] ); |
| + } |
| } |
| // TODO(nick): The correctness of device start depends on this cache being |