| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) { | 71 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) { |
| 72 shared_memory_factory_ = std::move(shared_memory_factory); | 72 shared_memory_factory_ = std::move(shared_memory_factory); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) { | 75 void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) { |
| 76 int64_t capture_start_time_nanos = rtc::TimeNanos(); | 76 int64_t capture_start_time_nanos = rtc::TimeNanos(); |
| 77 | 77 |
| 78 queue_.MoveToNextFrame(); | 78 queue_.MoveToNextFrame(); |
| 79 RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared()); | 79 RTC_DCHECK(!queue_.current_frame() || !queue_.current_frame()->IsShared()); |
| 80 | 80 |
| 81 // Request that the system not power-down the system, or the display hardware. | |
| 82 if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) { | |
| 83 if (!set_thread_execution_state_failed_) { | |
| 84 set_thread_execution_state_failed_ = true; | |
| 85 LOG_F(LS_WARNING) << "Failed to make system & display power assertion: " | |
| 86 << GetLastError(); | |
| 87 } | |
| 88 } | |
| 89 | |
| 90 // Make sure the GDI capture resources are up-to-date. | 81 // Make sure the GDI capture resources are up-to-date. |
| 91 PrepareCaptureResources(); | 82 PrepareCaptureResources(); |
| 92 | 83 |
| 93 if (!CaptureImage()) { | 84 if (!CaptureImage()) { |
| 94 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); | 85 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); |
| 95 return; | 86 return; |
| 96 } | 87 } |
| 97 | 88 |
| 98 const DesktopFrame* current_frame = queue_.current_frame(); | 89 const DesktopFrame* current_frame = queue_.current_frame(); |
| 99 const DesktopFrame* last_frame = queue_.previous_frame(); | 90 const DesktopFrame* last_frame = queue_.previous_frame(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 SRCCOPY | CAPTUREBLT); | 250 SRCCOPY | CAPTUREBLT); |
| 260 | 251 |
| 261 // Select back the previously selected object to that the device contect | 252 // Select back the previously selected object to that the device contect |
| 262 // could be destroyed independently of the bitmap if needed. | 253 // could be destroyed independently of the bitmap if needed. |
| 263 SelectObject(memory_dc_, previous_object); | 254 SelectObject(memory_dc_, previous_object); |
| 264 } | 255 } |
| 265 return true; | 256 return true; |
| 266 } | 257 } |
| 267 | 258 |
| 268 } // namespace webrtc | 259 } // namespace webrtc |
| OLD | NEW |