Bug 1729367 - P0 - Temp revert of Windows pid capture to allow for clean cherry-pick;r=mjf

Differential Revision: https://phabricator.services.mozilla.com/D129710
This commit is contained in:
Nico Grunbaum 2021-10-27 22:25:51 +00:00
Родитель cd6160382a
Коммит 858fdc781e
1 изменённых файлов: 0 добавлений и 12 удалений

Просмотреть файл

@ -168,7 +168,6 @@ bool IsWindowValidAndVisible(HWND window) {
BOOL CALLBACK FilterUncapturableWindows(HWND hwnd, LPARAM param) {
DesktopCapturer::SourceList* list =
reinterpret_cast<DesktopCapturer::SourceList*>(param);
// Skip windows that are invisible, minimized, have no title, or are owned,
// unless they have the app window style set.
int len = GetWindowTextLength(hwnd);
@ -178,7 +177,6 @@ BOOL CALLBACK FilterUncapturableWindows(HWND hwnd, LPARAM param) {
(owner && !(exstyle & WS_EX_APPWINDOW))) {
return TRUE;
}
// Skip unresponsive windows. Set timout with 50ms, in case system is under
// heavy load. We could wait longer and have a lower false negative, but that
// would delay the the enumeration.
@ -187,27 +185,19 @@ BOOL CALLBACK FilterUncapturableWindows(HWND hwnd, LPARAM param) {
nullptr)) {
return TRUE;
}
// Skip the Program Manager window and the Start button.
WCHAR class_name[256];
const int class_name_length =
GetClassNameW(hwnd, class_name, arraysize(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
// windows as well (e.g. toolbars).
if (wcscmp(class_name, L"Progman") == 0 || wcscmp(class_name, L"Button") == 0)
return TRUE;
DesktopCapturer::Source window;
window.id = reinterpret_cast<WindowId>(hwnd);
DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
window.pid = static_cast<pid_t>(pid);
// Truncate the title if it's longer than 500 characters.
WCHAR window_title[500];
GetWindowTextW(hwnd, window_title, arraysize(window_title));
@ -216,9 +206,7 @@ BOOL CALLBACK FilterUncapturableWindows(HWND hwnd, LPARAM param) {
// Skip windows when we failed to convert the title or it is empty.
if (window.title.empty())
return TRUE;
list->push_back(window);
return TRUE;
}