Open
[ArkWeb][安全][自动提交] 修复 Chromium issue 517207235: Fix race condition in CroppingWindowCapturer #124
[ArkWeb][安全][自动提交] 修复 Chromium issue 517207235: Fix race condition in CroppingWindowCapturer #124
Open
ringking0Add on Jul 7
Total: 1 files changed+10-0
@@ -92,6 +92,16 @@ void CroppingWindowCapturer::OnCaptureResult(
92 return;92 return;
93 }93 }
94 94 
95+ // We don't know when capture has occurred, so if the window moved we can't
96+ // assert which pixels we should capture. Capture again and we'll return a
97+ // frame once the window is stationary between the two calls.
98+ DesktopRect current_window_rect = GetWindowRectInVirtualScreen();
99+ if (!current_window_rect.equals(last_window_rect_)) {
100+ RTC_LOG(LS_INFO) << "Window moved during capture";
101+ window_capturer_->CaptureFrame();
102+ return;
103+ }
104+ 
95 if (result != Result::SUCCESS) {105 if (result != Result::SUCCESS) {
96 RTC_LOG(LS_WARNING) << "ScreenCapturer failed to capture a frame";106 RTC_LOG(LS_WARNING) << "ScreenCapturer failed to capture a frame";
97 callback_->OnCaptureResult(result, nullptr);107 callback_->OnCaptureResult(result, nullptr);