This change fixes a crash issue in WindowCapturerWin. The issue and fix are both
obvious, WindowCapturerWin should not return Result::SUCCESS with an empty
frame.
This issue was original introduced into the code base in change
https://codereview.webrtc.org/1988783003/.
I am also considering whether we should move the
previous_size_ = frame->size();
window_size_map_[window_] = previous_size_;
into the true branch. But since this change needs to be merged into M58 and M59,
I would prefer to keep it as small as possible.
BUG=712615
Review-Url: https://codereview.webrtc.org/2835553002
Cr-Commit-Position: refs/heads/master@{#17799}
diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc
index d796d0f..0ca88cf 100644
--- a/webrtc/modules/desktop_capture/window_capturer_win.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_win.cc
@@ -252,12 +252,12 @@
frame->mutable_updated_region()->SetRect(
DesktopRect::MakeSize(frame->size()));
- if (!result) {
+ if (result) {
+ callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
+ } else {
LOG(LS_ERROR) << "Both PrintWindow() and BitBlt() failed.";
- frame.reset();
+ callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
}
-
- callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
}
} // namespace