Use WindowFinder in WindowCapturer to detect IsOccluded()
In this change,
bool DesktopCapturer::IsOccluded(const DesktopVector& pos);
is added to DesktopCapturer interface. This function returns true if the |pos|
is hidden by other elements on the display.
The function expects to return false for ScreenCapturer implementations:
everything is visible on the screen.
In WindowCapturer implementations, WindowFinder is expected to be used to help
detect the WindowId under |pos|. If the window_id_ equals to the window id
returned by WindowFinder, this function returns false.
To ensure the correct coordinate is used, a comment is also added to
WindowFinder::GetWindowUnderPoint() function. Considering it's used only in
desktop_capture module, using system coordinate is simpler.
Bug: webrtc:7950
Change-Id: I8ac4fbd5f4a612388f1593907805cfb2c359f70f
Reviewed-on: https://chromium-review.googlesource.com/636784
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Zijie He <zijiehe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#19590}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 12827113a1c1467065b124886dd658e6274a5ba5
diff --git a/modules/desktop_capture/desktop_capture_options.h b/modules/desktop_capture/desktop_capture_options.h
index e10cab7..8956275 100644
--- a/modules/desktop_capture/desktop_capture_options.h
+++ b/modules/desktop_capture/desktop_capture_options.h
@@ -49,14 +49,22 @@
#endif
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
+ // TODO(zijiehe): Remove both DesktopConfigurationMonitor and
+ // FullScreenChromeWindowDetector out of DesktopCaptureOptions. It's not
+ // reasonable for external consumers to set these two parameters.
DesktopConfigurationMonitor* configuration_monitor() const {
return configuration_monitor_;
}
+ // If nullptr is set, ScreenCapturer won't work and WindowCapturer may return
+ // inaccurate result from IsOccluded() function.
void set_configuration_monitor(
rtc::scoped_refptr<DesktopConfigurationMonitor> m) {
configuration_monitor_ = m;
}
+ // TODO(zijiehe): Instead of FullScreenChromeWindowDetector, provide a
+ // FullScreenWindowDetector for external consumers to detect the target
+ // fullscreen window.
FullScreenChromeWindowDetector* full_screen_chrome_window_detector() const {
return full_screen_window_detector_;
}
@@ -83,8 +91,6 @@
// Flag that should be set if the consumer uses updated_region() and the
// capturer should try to provide correct updated_region() for the frames it
// generates (e.g. by comparing each frame with the previous one).
- // TODO(zijiehe): WindowCapturer ignores this opinion until we merge
- // ScreenCapturer and WindowCapturer interfaces.
bool detect_updated_region() const { return detect_updated_region_; }
void set_detect_updated_region(bool detect_updated_region) {
detect_updated_region_ = detect_updated_region;