Do not use Magnifier if there are multiple screens since it sometimes crashes.
BUG=crbug/478825
R=sergeyu@chromium.org
Review URL: https://webrtc-codereview.appspot.com/43289004
Cr-Commit-Position: refs/heads/master@{#9082}
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
index d812004..e6087f1 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
@@ -109,9 +109,9 @@
bool succeeded = false;
- // Do not try to use the magnfiier if it's capturing non-primary screen, or it
- // failed before.
- if (magnifier_initialized_ && IsCapturingPrimaryScreenOnly() &&
+ // Do not try to use the magnifier if it failed before and in multi-screen
+ // setup (where the API crashes sometimes).
+ if (magnifier_initialized_ && (GetSystemMetrics(SM_CMONITORS) == 1) &&
magnifier_capture_succeeded_) {
DesktopRect rect = GetScreenRect(current_screen_id_, current_device_key_);
CreateCurrentFrameIfNecessary(rect.size());
@@ -436,13 +436,6 @@
}
}
-bool ScreenCapturerWinMagnifier::IsCapturingPrimaryScreenOnly() const {
- if (current_screen_id_ != kFullDesktopScreenId)
- return current_screen_id_ == 0; // the primary screen is always '0'.
-
- return GetSystemMetrics(SM_CMONITORS) == 1;
-}
-
void ScreenCapturerWinMagnifier::StartFallbackCapturer() {
assert(fallback_capturer_);
if (!fallback_capturer_started_) {
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h
index 5bc0f81..b33b873 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h
@@ -96,9 +96,6 @@
// Makes sure the current frame exists and matches |size|.
void CreateCurrentFrameIfNecessary(const DesktopSize& size);
- // Returns true if we are capturing the primary screen only.
- bool IsCapturingPrimaryScreenOnly() const;
-
// Start the fallback capturer and select the screen.
void StartFallbackCapturer();