WindowCapturerWin: properly check return value of GetClassName

In debug mode I hit the assert so this function can return 0. So
just skip the window in that case like for other desktop elements

Bug: None
Change-Id: I92abf2a1f450b677632f5eb4332ca218cfd850ec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143860
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28408}
diff --git a/modules/desktop_capture/win/window_capture_utils.cc b/modules/desktop_capture/win/window_capture_utils.cc
index 8454633..ef60c9f 100644
--- a/modules/desktop_capture/win/window_capture_utils.cc
+++ b/modules/desktop_capture/win/window_capture_utils.cc
@@ -186,9 +186,8 @@
   const size_t kClassLength = 256;
   WCHAR class_name[kClassLength];
   const int class_name_length = GetClassNameW(hwnd, class_name, kClassLength);
-  RTC_DCHECK(class_name_length)
-      << "Error retrieving the application's class name";
-  if (wcsncmp(class_name, kChromeWindowClassPrefix,
+  if (class_name_length < 1 ||
+      wcsncmp(class_name, kChromeWindowClassPrefix,
               wcsnlen_s(kChromeWindowClassPrefix, kClassLength)) != 0) {
     return false;
   }
diff --git a/modules/desktop_capture/window_capturer_win.cc b/modules/desktop_capture/window_capturer_win.cc
index 4ab1feb..3dbec83 100644
--- a/modules/desktop_capture/window_capturer_win.cc
+++ b/modules/desktop_capture/window_capturer_win.cc
@@ -54,8 +54,8 @@
   const size_t kClassLength = 256;
   WCHAR class_name[kClassLength];
   const int class_name_length = GetClassNameW(hwnd, class_name, kClassLength);
-  RTC_DCHECK(class_name_length)
-      << "Error retrieving the application's class name";
+  if (class_name_length < 1)
+    return TRUE;
 
   // Skip Program Manager window and the Start button. This is the same logic
   // that's used in Win32WindowPicker in libjingle. Consider filtering other