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 |
11 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" | 11 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 | 14 |
15 #include <utility> | 15 #include <utility> |
16 | 16 |
17 #include "webrtc/base/timeutils.h" | |
17 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 18 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 19 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
19 #include "webrtc/modules/desktop_capture/desktop_frame_win.h" | 20 #include "webrtc/modules/desktop_capture/desktop_frame_win.h" |
20 #include "webrtc/modules/desktop_capture/desktop_region.h" | 21 #include "webrtc/modules/desktop_capture/desktop_region.h" |
21 #include "webrtc/modules/desktop_capture/differ.h" | 22 #include "webrtc/modules/desktop_capture/differ.h" |
22 #include "webrtc/modules/desktop_capture/mouse_cursor.h" | 23 #include "webrtc/modules/desktop_capture/mouse_cursor.h" |
23 #include "webrtc/modules/desktop_capture/win/cursor.h" | 24 #include "webrtc/modules/desktop_capture/win/cursor.h" |
24 #include "webrtc/modules/desktop_capture/win/desktop.h" | 25 #include "webrtc/modules/desktop_capture/win/desktop.h" |
25 #include "webrtc/modules/desktop_capture/win/screen_capture_utils.h" | 26 #include "webrtc/modules/desktop_capture/win/screen_capture_utils.h" |
26 #include "webrtc/system_wrappers/include/logging.h" | 27 #include "webrtc/system_wrappers/include/logging.h" |
27 #include "webrtc/system_wrappers/include/tick_util.h" | |
28 | 28 |
29 namespace webrtc { | 29 namespace webrtc { |
30 | 30 |
31 // kMagnifierWindowClass has to be "Magnifier" according to the Magnification | 31 // kMagnifierWindowClass has to be "Magnifier" according to the Magnification |
32 // API. The other strings can be anything. | 32 // API. The other strings can be anything. |
33 static LPCTSTR kMagnifierHostClass = L"ScreenCapturerWinMagnifierHost"; | 33 static LPCTSTR kMagnifierHostClass = L"ScreenCapturerWinMagnifierHost"; |
34 static LPCTSTR kHostWindowName = L"MagnifierHost"; | 34 static LPCTSTR kHostWindowName = L"MagnifierHost"; |
35 static LPCTSTR kMagnifierWindowClass = L"Magnifier"; | 35 static LPCTSTR kMagnifierWindowClass = L"Magnifier"; |
36 static LPCTSTR kMagnifierWindowName = L"MagnifierWindow"; | 36 static LPCTSTR kMagnifierWindowName = L"MagnifierWindow"; |
37 | 37 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 InitializeMagnifier(); | 81 InitializeMagnifier(); |
82 } | 82 } |
83 | 83 |
84 void ScreenCapturerWinMagnifier::SetSharedMemoryFactory( | 84 void ScreenCapturerWinMagnifier::SetSharedMemoryFactory( |
85 rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) { | 85 rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) { |
86 shared_memory_factory_ = | 86 shared_memory_factory_ = |
87 rtc::ScopedToUnique(std::move(shared_memory_factory)); | 87 rtc::ScopedToUnique(std::move(shared_memory_factory)); |
88 } | 88 } |
89 | 89 |
90 void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) { | 90 void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) { |
91 TickTime capture_start_time = TickTime::Now(); | 91 int64_t capture_start_time = rtc::TimeNanos(); |
stefan-webrtc
2016/04/19 09:19:12
_nanos
nisse-webrtc
2016/04/19 12:19:25
Done.
| |
92 | 92 |
93 queue_.MoveToNextFrame(); | 93 queue_.MoveToNextFrame(); |
94 | 94 |
95 // Request that the system not power-down the system, or the display hardware. | 95 // Request that the system not power-down the system, or the display hardware. |
96 if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) { | 96 if (!SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED)) { |
97 if (!set_thread_execution_state_failed_) { | 97 if (!set_thread_execution_state_failed_) { |
98 set_thread_execution_state_failed_ = true; | 98 set_thread_execution_state_failed_ = true; |
99 LOG_F(LS_WARNING) << "Failed to make system & display power assertion: " | 99 LOG_F(LS_WARNING) << "Failed to make system & display power assertion: " |
100 << GetLastError(); | 100 << GetLastError(); |
101 } | 101 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 | 162 |
163 helper_.set_size_most_recent(current_frame->size()); | 163 helper_.set_size_most_recent(current_frame->size()); |
164 | 164 |
165 // Emit the current frame. | 165 // Emit the current frame. |
166 DesktopFrame* frame = queue_.current_frame()->Share(); | 166 DesktopFrame* frame = queue_.current_frame()->Share(); |
167 frame->set_dpi(DesktopVector(GetDeviceCaps(desktop_dc_, LOGPIXELSX), | 167 frame->set_dpi(DesktopVector(GetDeviceCaps(desktop_dc_, LOGPIXELSX), |
168 GetDeviceCaps(desktop_dc_, LOGPIXELSY))); | 168 GetDeviceCaps(desktop_dc_, LOGPIXELSY))); |
169 frame->mutable_updated_region()->Clear(); | 169 frame->mutable_updated_region()->Clear(); |
170 helper_.TakeInvalidRegion(frame->mutable_updated_region()); | 170 helper_.TakeInvalidRegion(frame->mutable_updated_region()); |
171 frame->set_capture_time_ms( | 171 frame->set_capture_time_ms( |
172 (TickTime::Now() - capture_start_time).Milliseconds()); | 172 (rtc::TimeNanos() - capture_start_time) / rtc::kNumNanosecsPerMillisec; |
173 callback_->OnCaptureCompleted(frame); | 173 callback_->OnCaptureCompleted(frame); |
174 } | 174 } |
175 | 175 |
176 bool ScreenCapturerWinMagnifier::GetScreenList(ScreenList* screens) { | 176 bool ScreenCapturerWinMagnifier::GetScreenList(ScreenList* screens) { |
177 return webrtc::GetScreenList(screens); | 177 return webrtc::GetScreenList(screens); |
178 } | 178 } |
179 | 179 |
180 bool ScreenCapturerWinMagnifier::SelectScreen(ScreenId id) { | 180 bool ScreenCapturerWinMagnifier::SelectScreen(ScreenId id) { |
181 bool valid = IsScreenValid(id, ¤t_device_key_); | 181 bool valid = IsScreenValid(id, ¤t_device_key_); |
182 | 182 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 assert(fallback_capturer_); | 441 assert(fallback_capturer_); |
442 if (!fallback_capturer_started_) { | 442 if (!fallback_capturer_started_) { |
443 fallback_capturer_started_ = true; | 443 fallback_capturer_started_ = true; |
444 | 444 |
445 fallback_capturer_->Start(callback_); | 445 fallback_capturer_->Start(callback_); |
446 fallback_capturer_->SelectScreen(current_screen_id_); | 446 fallback_capturer_->SelectScreen(current_screen_id_); |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 } // namespace webrtc | 450 } // namespace webrtc |
OLD | NEW |