OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/video/capture/screen/screen_capturer.h" | 5 #include "media/video/capture/screen/screen_capturer.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 ScreenCapturerWin::~ScreenCapturerWin() { | 209 ScreenCapturerWin::~ScreenCapturerWin() { |
210 } | 210 } |
211 | 211 |
212 void ScreenCapturerWin::InvalidateRegion(const SkRegion& invalid_region) { | 212 void ScreenCapturerWin::InvalidateRegion(const SkRegion& invalid_region) { |
213 helper_.InvalidateRegion(invalid_region); | 213 helper_.InvalidateRegion(invalid_region); |
214 } | 214 } |
215 | 215 |
216 void ScreenCapturerWin::CaptureFrame() { | 216 void ScreenCapturerWin::CaptureFrame() { |
217 base::Time capture_start_time = base::Time::Now(); | 217 base::Time capture_start_time = base::Time::Now(); |
218 | 218 |
219 // Force the system to power-up display hardware, if it has been suspended. | 219 // Request that the system not power-down the system, or the display hardware. |
220 SetThreadExecutionState(ES_DISPLAY_REQUIRED); | 220 if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) { |
221 LOG(WARNING) << "Failed to make system & display power assertion"; | |
alexeypa (please no reviews)
2013/02/11 17:02:28
nit #1: LOG_GETLASTERROR(WARNING).
nit #2: this w
Wez
2013/02/12 01:52:46
I've settled on just logging the first failure per
| |
222 } | |
221 | 223 |
222 // Make sure the GDI capture resources are up-to-date. | 224 // Make sure the GDI capture resources are up-to-date. |
223 PrepareCaptureResources(); | 225 PrepareCaptureResources(); |
224 | 226 |
225 // Copy screen bits to the current buffer. | 227 // Copy screen bits to the current buffer. |
226 CaptureImage(); | 228 CaptureImage(); |
227 | 229 |
228 const ScreenCaptureFrame* current_buffer = queue_.current_frame(); | 230 const ScreenCaptureFrame* current_buffer = queue_.current_frame(); |
229 const ScreenCaptureFrame* last_buffer = queue_.previous_frame(); | 231 const ScreenCaptureFrame* last_buffer = queue_.previous_frame(); |
230 if (last_buffer) { | 232 if (last_buffer) { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 void ScreenCapturer::Delegate::ReleaseSharedBuffer( | 579 void ScreenCapturer::Delegate::ReleaseSharedBuffer( |
578 scoped_refptr<SharedBuffer> buffer) { | 580 scoped_refptr<SharedBuffer> buffer) { |
579 } | 581 } |
580 | 582 |
581 // static | 583 // static |
582 scoped_ptr<ScreenCapturer> ScreenCapturer::Create() { | 584 scoped_ptr<ScreenCapturer> ScreenCapturer::Create() { |
583 return scoped_ptr<ScreenCapturer>(new ScreenCapturerWin()); | 585 return scoped_ptr<ScreenCapturer>(new ScreenCapturerWin()); |
584 } | 586 } |
585 | 587 |
586 } // namespace media | 588 } // namespace media |
OLD | NEW |