Chromium Code Reviews| 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 f36f4e6a3aec4a6de6e3b66cd64ee53811d5ee8e..876c17f6810ceacf5a97f09e91b725c4875aae78 100644 |
| --- a/media/video/capture/win/video_capture_device_factory_win.cc |
| +++ b/media/video/capture/win/video_capture_device_factory_win.cc |
| @@ -110,10 +110,6 @@ static void GetDeviceNamesDirectShow( |
| if (hr != S_OK) |
| return; |
| - // Name of a fake DirectShow filter that exist on computers with |
| - // GTalk installed. |
| - static const char kGoogleCameraAdapter[] = "google camera adapter"; |
| - |
| // Enumerate all video capture devices. |
| ScopedComPtr<IMoniker> moniker; |
| int index = 0; |
| @@ -131,32 +127,37 @@ static void GetDeviceNamesDirectShow( |
| if (FAILED(hr)) |
| hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0); |
| - if (SUCCEEDED(hr) && name.type() == VT_BSTR) { |
| - // Ignore all VFW drivers and the special Google Camera Adapter. |
| - // Google Camera Adapter is not a real DirectShow camera device. |
| - // VFW are very old Video for Windows drivers that can not be used. |
| - const wchar_t* str_ptr = V_BSTR(&name); |
| - const int name_length = arraysize(kGoogleCameraAdapter) - 1; |
| - |
| - if ((wcsstr(str_ptr, L"(VFW)") == NULL) && |
| - lstrlenW(str_ptr) < name_length || |
| - (!(LowerCaseEqualsASCII(str_ptr, str_ptr + name_length, |
| - kGoogleCameraAdapter)))) { |
| - std::string id; |
| - std::string device_name(base::SysWideToUTF8(str_ptr)); |
| - name.Reset(); |
| - hr = prop_bag->Read(L"DevicePath", name.Receive(), 0); |
| - if (FAILED(hr) || name.type() != VT_BSTR) { |
| - id = device_name; |
| - } else { |
| - DCHECK_EQ(name.type(), VT_BSTR); |
| - id = base::SysWideToUTF8(V_BSTR(&name)); |
| - } |
| - device_names->push_back(Name(device_name, id, capture_api_type)); |
| - } |
| + if (FAILED(hr) || name.type() != VT_BSTR) |
| + continue; |
|
mcasas
2014/09/04 16:31:12
Missing moniker.Release();
|
| + |
| + // Ignore all VFW drivers and the special Google Camera Adapter. |
| + // Google Camera Adapter is not a real DirectShow camera device. |
| + // VFW are very old Video for Windows drivers that can not be used. |
| + const wchar_t* str_ptr = V_BSTR(&name); |
| + // Name of a fake DirectShow filter that exist on computers with |
| + // GTalk installed. |
| + static const char kGoogleCameraAdapter[] = "google camera adapter"; |
| + if (wcsstr(str_ptr, L"(VFW)") != NULL || |
| + LowerCaseEqualsASCII(str_ptr, |
| + str_ptr + arraysize(kGoogleCameraAdapter) - 1, |
| + kGoogleCameraAdapter)) { |
| + continue; |
|
mcasas
2014/09/04 16:31:12
missing moniker.Release();
|
| } |
| - moniker.Release(); |
| + |
| + const std::string device_name(base::SysWideToUTF8(str_ptr)); |
| + name.Reset(); |
| + hr = prop_bag->Read(L"DevicePath", name.Receive(), 0); |
| + std::string id; |
| + if (FAILED(hr) || name.type() != VT_BSTR) { |
| + id = device_name; |
| + } else { |
| + DCHECK_EQ(name.type(), VT_BSTR); |
| + id = base::SysWideToUTF8(V_BSTR(&name)); |
| + } |
| + device_names->push_back(Name(device_name, id, capture_api_type)); |
| } |
| + |
| + moniker.Release(); |
|
mcasas
2014/09/04 16:31:12
With so many moniker.Release();, is getting too ve
|
| } |
| static void GetDeviceNamesMediaFoundation(Names* device_names) { |