From c94bd9bf86d39b2b17ffaad0775d28e875f24b08 Mon Sep 17 00:00:00 2001 From: gyzhou Date: Tue, 10 Nov 2015 07:33:51 -0800 Subject: [PATCH] If a desktop captured window switches on/off it full screen mode, the capture may be unexpectedly terminated. During the transition of full screen mode on/off, the window can be temporarily invisible. BUG=498484 Review URL: https://codereview.webrtc.org/1426103005 Cr-Commit-Position: refs/heads/master@{#10583} --- webrtc/modules/desktop_capture/window_capturer_win.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc index c0d71167a5..54b2768aa8 100644 --- a/webrtc/modules/desktop_capture/window_capturer_win.cc +++ b/webrtc/modules/desktop_capture/window_capturer_win.cc @@ -156,15 +156,16 @@ void WindowCapturerWin::Capture(const DesktopRegion& region) { return; } - // Stop capturing if the window has been closed or hidden. - if (!IsWindow(window_) || !IsWindowVisible(window_)) { + // Stop capturing if the window has been closed. + if (!IsWindow(window_)) { callback_->OnCaptureCompleted(NULL); return; } - // Return a 1x1 black frame if the window is minimized, to match the behavior - // on Mac. - if (IsIconic(window_)) { + // Return a 1x1 black frame if the window is minimized or invisible, to match + // behavior on mace. Window can be temporarily invisible during the + // transition of full screen mode on/off. + if (IsIconic(window_) || !IsWindowVisible(window_)) { BasicDesktopFrame* frame = new BasicDesktopFrame(DesktopSize(1, 1)); memset(frame->data(), 0, frame->stride() * frame->size().height());