Index: media/video/capture/win/video_capture_device_factory_win.cc |
diff --git a/media/video/capture/win/video_capture_device_factory_win.cc b/media/video/capture/win/video_capture_device_factory_win.cc |
index ad2922bd94ea48cdd1d2cbc7be1734daa755a48f..7bd6b2907c54c8eba948917daa288eb143074190 100644 |
--- a/media/video/capture/win/video_capture_device_factory_win.cc |
+++ b/media/video/capture/win/video_capture_device_factory_win.cc |
@@ -222,12 +222,31 @@ static void GetDeviceSupportedFormatsDirectShow(const Name& device, |
if (hr != S_OK) |
return; |
- // Walk the capture devices. No need to check for device presence again, that |
- // is caught in GetDeviceFilter(). "google camera adapter" and old VFW devices |
- // are already skipped in the previous GetDeviceNames() enumeration. |
+ // Walk the capture devices. No need to check for device presence again since |
+ // that is anyway needed in GetDeviceFilter(). "google camera adapter" and old |
+ // VFW devices are already skipped previously in GetDeviceNames() enumeration. |
base::win::ScopedComPtr<IBaseFilter> capture_filter; |
- hr = VideoCaptureDeviceWin::GetDeviceFilter(device, |
- capture_filter.Receive()); |
+ if (device.capture_api_type() == Name::DIRECT_SHOW_WDM) { |
+ // Find the "normal" DirectShow device corresponding to the WDM device by |
+ // comparing USB IDs. |
+ // TODO(mcasas): USB ID comparison won't work with PCIe capture cards. |
+ Names device_names; |
+ GetDeviceNamesDirectShow(&device_names); |
+ const std::string current_device_model = device.GetModel(); |
+ for (Names::const_iterator iter = device_names.begin(); |
+ iter != device_names.end(); ++iter) { |
+ if ((iter->GetModel().compare(current_device_model) == 0) && |
+ (iter->capture_api_type() == Name::DIRECT_SHOW)) { |
+ DVLOG(1) << "Enumerating formats for a WDM device."; |
+ hr = VideoCaptureDeviceWin::GetDeviceFilter(*iter, |
perkj_chrome
2014/09/01 09:57:43
GetDeviceFilter need the correct Name::id. So why
|
+ capture_filter.Receive()); |
+ break; |
+ } |
+ } |
+ } else { |
+ hr = VideoCaptureDeviceWin::GetDeviceFilter(device, |
+ capture_filter.Receive()); |
+ } |
if (!capture_filter) { |
DVLOG(2) << "Failed to create capture filter."; |
return; |