[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 <zijiehe@chromium.org>
Commit-Queue: Brave Yao <braveyao@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23154}
This commit is contained in:
braveyao 2018-05-04 16:34:11 -07:00 committed by Commit Bot
parent 4a22921985
commit 1f184f0a15

View File

@ -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<IOSurfaceRef>(io_surface, rtc::RetainPolicy::RETAIN));
helper_.InvalidateRegion(region);
}
std::unique_ptr<DesktopFrame> ScreenCapturerMac::CreateFrame() {