Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: media/video/capture/win/video_capture_device_factory_win.cc

Issue 541603002: Fix if-statement in win video capture that ignores fake DirectShow filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c46daba474c062d0d78d57367a5d58bf7a98497c 100644
--- a/media/video/capture/win/video_capture_device_factory_win.cc
+++ b/media/video/capture/win/video_capture_device_factory_win.cc
@@ -122,10 +122,6 @@ static void GetDeviceNamesDirectShow(Names* device_names) {
if (hr != S_OK)
continue;
- // 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;
@@ -149,16 +145,17 @@ static void GetDeviceNamesDirectShow(Names* device_names) {
// 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 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)) {
+ 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 {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698