From 1f184f0a15400765a1e6ba5982ac092b1af14b1d Mon Sep 17 00:00:00 2001 From: braveyao Date: Fri, 4 May 2018 16:34:11 -0700 Subject: [PATCH] [desktopCapture Mac] have latest iosurface before invalidating region Always having the latest iosurface before invalidating a region. Otherwise if CaptureFrame() happens in between, the capture result may not be fully refreshed. Also we can't add lock since it will impact performance. Bug: webrtc:8652 Change-Id: Ib23105b16065018c691685083b76a771ce8771d3 Reviewed-on: https://webrtc-review.googlesource.com/74643 Reviewed-by: Zijie He Commit-Queue: Brave Yao Cr-Commit-Position: refs/heads/master@{#23154} --- modules/desktop_capture/mac/screen_capturer_mac.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm index 06f735d8dc..20a2b93340 100644 --- a/modules/desktop_capture/mac/screen_capturer_mac.mm +++ b/modules/desktop_capture/mac/screen_capturer_mac.mm @@ -590,11 +590,11 @@ void ScreenCapturerMac::ScreenRefresh(CGDirectDisplayID display_id, region.AddRect(rect); } - - helper_.InvalidateRegion(region); - + // Always having the latest iosurface before invalidating a region. + // See https://bugs.chromium.org/p/webrtc/issues/detail?id=8652 for details. desktop_frame_provider_.InvalidateIOSurface( display_id, rtc::ScopedCFTypeRef(io_surface, rtc::RetainPolicy::RETAIN)); + helper_.InvalidateRegion(region); } std::unique_ptr ScreenCapturerMac::CreateFrame() {