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}
This commit is contained in:
zijiehe 2017-04-20 14:53:36 -07:00 committed by Commit bot
parent d07061c9f3
commit d41af462fb

View File

@ -252,12 +252,12 @@ void WindowCapturerWin::CaptureFrame() {
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