OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 callback_ = callback; | 149 callback_ = callback; |
150 } | 150 } |
151 | 151 |
152 void WindowCapturerWin::Capture(const DesktopRegion& region) { | 152 void WindowCapturerWin::Capture(const DesktopRegion& region) { |
153 if (!window_) { | 153 if (!window_) { |
154 LOG(LS_ERROR) << "Window hasn't been selected: " << GetLastError(); | 154 LOG(LS_ERROR) << "Window hasn't been selected: " << GetLastError(); |
155 callback_->OnCaptureCompleted(NULL); | 155 callback_->OnCaptureCompleted(NULL); |
156 return; | 156 return; |
157 } | 157 } |
158 | 158 |
159 // Stop capturing if the window has been closed or hidden. | 159 // Stop capturing if the window has been closed. |
160 if (!IsWindow(window_) || !IsWindowVisible(window_)) { | 160 if (!IsWindow(window_)) { |
161 callback_->OnCaptureCompleted(NULL); | 161 callback_->OnCaptureCompleted(NULL); |
162 return; | 162 return; |
163 } | 163 } |
164 | 164 |
165 // Return a 1x1 black frame if the window is minimized, to match the behavior | 165 // Return a 1x1 black frame if the window is minimized or invisible, to match |
166 // on Mac. | 166 // behavior on mace. Window can be temporarily invisible during the |
167 if (IsIconic(window_)) { | 167 // transition of full screen mode on/off. |
| 168 if (IsIconic(window_) || !IsWindowVisible(window_)) { |
168 BasicDesktopFrame* frame = new BasicDesktopFrame(DesktopSize(1, 1)); | 169 BasicDesktopFrame* frame = new BasicDesktopFrame(DesktopSize(1, 1)); |
169 memset(frame->data(), 0, frame->stride() * frame->size().height()); | 170 memset(frame->data(), 0, frame->stride() * frame->size().height()); |
170 | 171 |
171 previous_size_ = frame->size(); | 172 previous_size_ = frame->size(); |
172 callback_->OnCaptureCompleted(frame); | 173 callback_->OnCaptureCompleted(frame); |
173 return; | 174 return; |
174 } | 175 } |
175 | 176 |
176 DesktopRect original_rect; | 177 DesktopRect original_rect; |
177 DesktopRect cropped_rect; | 178 DesktopRect cropped_rect; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 249 } |
249 | 250 |
250 } // namespace | 251 } // namespace |
251 | 252 |
252 // static | 253 // static |
253 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { | 254 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { |
254 return new WindowCapturerWin(); | 255 return new WindowCapturerWin(); |
255 } | 256 } |
256 | 257 |
257 } // namespace webrtc | 258 } // namespace webrtc |
OLD | NEW |