Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 21721bc

Browse files
author
Zijie He
committed
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} (cherry picked from commit d41af46) Review-Url: https://codereview.webrtc.org/2834923002 . Cr-Commit-Position: refs/branch-heads/59@{#2} Cr-Branched-From: 10d095d-refs/heads/master@{#17657}
1 parent a100a39 commit 21721bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webrtc/modules/desktop_capture/window_capturer_win.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ void WindowCapturerWin::CaptureFrame() {
252252
frame->mutable_updated_region()->SetRect(
253253
DesktopRect::MakeSize(frame->size()));
254254

255-
if (!result) {
255+
if (result) {
256+
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
257+
} else {
256258
LOG(LS_ERROR) << "Both PrintWindow() and BitBlt() failed.";
257-
frame.reset();
259+
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
258260
}
259-
260-
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
261261
}
262262

263263
} // namespace

0 commit comments

Comments
 (0)