From fd6d8d7129ee1cdf81850ac71f6cf4452cb1f65c Mon Sep 17 00:00:00 2001 From: Bryan Ferguson Date: Fri, 26 Jul 2019 10:37:38 -0700 Subject: [PATCH] Make CroppingWindowCapturer respect detect_updated_region on Windows This change makes CroppingWindowCapturer::CreateCapturer respect the detect_updated_region flag if set in the options it's passed on Windows. Frames captured by the created capturer will now make changes available via DesktopFrame.updated_region(). Bug: webrtc:10833 Change-Id: Ib973bc58745ebf6e216a7b31f82abec3c6dc9556 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147002 Reviewed-by: Jamie Walch Commit-Queue: Jamie Walch Cr-Commit-Position: refs/heads/master@{#28694} --- modules/desktop_capture/cropping_window_capturer_win.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/desktop_capture/cropping_window_capturer_win.cc b/modules/desktop_capture/cropping_window_capturer_win.cc index af61dea2fa..57aaf561db 100644 --- a/modules/desktop_capture/cropping_window_capturer_win.cc +++ b/modules/desktop_capture/cropping_window_capturer_win.cc @@ -9,6 +9,7 @@ */ #include "modules/desktop_capture/cropping_window_capturer.h" +#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h" #include "modules/desktop_capture/win/screen_capture_utils.h" #include "modules/desktop_capture/win/window_capture_utils.h" #include "rtc_base/logging.h" @@ -263,8 +264,13 @@ DesktopRect CroppingWindowCapturerWin::GetWindowRectInVirtualScreen() { // static std::unique_ptr CroppingWindowCapturer::CreateCapturer( const DesktopCaptureOptions& options) { - return std::unique_ptr( + std::unique_ptr capturer( new CroppingWindowCapturerWin(options)); + if (capturer && options.detect_updated_region()) { + capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer))); + } + + return capturer; } } // namespace webrtc