WebRtc Win Desktop capture: ignore Win8+ Modern Apps' windows.

Microsoft introduced modern app from win8. Modern apps can be used cross Microsoft's platforms.

It was confirmed from Microsoft that there is no support for modern app's window capture.

BUG=526883

Review URL: https://codereview.webrtc.org/1371383003

Cr-Commit-Position: refs/heads/master@{#10154}
This commit is contained in:
gyzhou 2015-10-02 15:36:30 -07:00 committed by Commit bot
parent 913e645e10
commit 371dc7e560

View File

@ -13,6 +13,7 @@
#include <assert.h>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/win32.h"
#include "webrtc/modules/desktop_capture/desktop_frame_win.h"
#include "webrtc/modules/desktop_capture/win/window_capture_utils.h"
@ -39,13 +40,26 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
// Skip the Program Manager window and the Start button.
const size_t kClassLength = 256;
WCHAR class_name[kClassLength];
GetClassName(hwnd, class_name, kClassLength);
const int class_name_length = GetClassName(hwnd, class_name, kClassLength);
RTC_DCHECK(class_name_length)
<< "Error retrieving the application's class name";
// Skip Program Manager window and the Start button. This is the same logic
// that's used in Win32WindowPicker in libjingle. Consider filtering other
// windows as well (e.g. toolbars).
if (wcscmp(class_name, L"Progman") == 0 || wcscmp(class_name, L"Button") == 0)
return TRUE;
// Windows 8 introduced a "Modern App" identified by their class name being
// either ApplicationFrameWindow or windows.UI.Core.coreWindow. The
// associated windows cannot be captured, so we skip them.
// http://crbug.com/526883.
if (rtc::IsWindows8OrLater() &&
(wcscmp(class_name, L"ApplicationFrameWindow") == 0 ||
wcscmp(class_name, L"Windows.UI.Core.CoreWindow") == 0)) {
return TRUE;
}
WindowCapturer::Window window;
window.id = reinterpret_cast<WindowCapturer::WindowId>(hwnd);