OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ |
13 | 13 |
14 #include <D3DCommon.h> | 14 #include <D3DCommon.h> |
15 | 15 |
16 #include <atomic> | 16 #include <atomic> |
| 17 #include <string> |
17 #include <vector> | 18 #include <vector> |
18 | 19 |
19 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 20 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
20 #include "webrtc/modules/desktop_capture/resolution_change_detector.h" | 21 #include "webrtc/modules/desktop_capture/resolution_change_detector.h" |
21 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 22 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
22 #include "webrtc/modules/desktop_capture/win/d3d_device.h" | 23 #include "webrtc/modules/desktop_capture/win/d3d_device.h" |
23 #include "webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h" | 24 #include "webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h" |
24 #include "webrtc/modules/desktop_capture/win/dxgi_context.h" | 25 #include "webrtc/modules/desktop_capture/win/dxgi_context.h" |
25 #include "webrtc/modules/desktop_capture/win/dxgi_frame.h" | 26 #include "webrtc/modules/desktop_capture/win/dxgi_frame.h" |
26 #include "webrtc/rtc_base/criticalsection.h" | 27 #include "webrtc/rtc_base/criticalsection.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 95 |
95 // Returns dpi of current system. Returns an empty DesktopVector if system | 96 // Returns dpi of current system. Returns an empty DesktopVector if system |
96 // does not support DXGI based capturer. | 97 // does not support DXGI based capturer. |
97 DesktopVector dpi(); | 98 DesktopVector dpi(); |
98 | 99 |
99 // Returns the count of screens on the system. These screens can be retrieved | 100 // Returns the count of screens on the system. These screens can be retrieved |
100 // by an integer in the range of [0, ScreenCount()). If system does not | 101 // by an integer in the range of [0, ScreenCount()). If system does not |
101 // support DXGI based capturer, this function returns 0. | 102 // support DXGI based capturer, this function returns 0. |
102 int ScreenCount(); | 103 int ScreenCount(); |
103 | 104 |
| 105 // Returns the device names of all screens on the system in utf8 encoding. |
| 106 // These screens can be retrieved by an integer in the range of |
| 107 // [0, output->size()). If system does not support DXGI based capturer, this |
| 108 // function returns false. |
| 109 bool GetDeviceNames(std::vector<std::string>* output); |
| 110 |
104 private: | 111 private: |
105 // DxgiFrameContext calls private Unregister(Context*) function during | 112 // DxgiFrameContext calls private Unregister(Context*) function during |
106 // destructing. | 113 // destructing. |
107 friend DxgiFrameContext::~DxgiFrameContext(); | 114 friend DxgiFrameContext::~DxgiFrameContext(); |
108 | 115 |
109 // scoped_refptr<DxgiDuplicatorController> accesses private AddRef() and | 116 // scoped_refptr<DxgiDuplicatorController> accesses private AddRef() and |
110 // Release() functions. | 117 // Release() functions. |
111 friend class rtc::scoped_refptr<DxgiDuplicatorController>; | 118 friend class rtc::scoped_refptr<DxgiDuplicatorController>; |
112 | 119 |
113 // A private constructor to ensure consumers to use | 120 // A private constructor to ensure consumers to use |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Returns a DesktopSize to cover entire |desktop_rect_|. | 183 // Returns a DesktopSize to cover entire |desktop_rect_|. |
177 DesktopSize desktop_size() const; | 184 DesktopSize desktop_size() const; |
178 | 185 |
179 // Returns the size of one screen. |id| should be >= 0. If system does not | 186 // Returns the size of one screen. |id| should be >= 0. If system does not |
180 // support DXGI based capturer, or |id| is greater than the total screen count | 187 // support DXGI based capturer, or |id| is greater than the total screen count |
181 // of all the Duplicators, this function returns an empty DesktopRect. | 188 // of all the Duplicators, this function returns an empty DesktopRect. |
182 DesktopRect ScreenRect(int id) const; | 189 DesktopRect ScreenRect(int id) const; |
183 | 190 |
184 int ScreenCountUnlocked() const; | 191 int ScreenCountUnlocked() const; |
185 | 192 |
| 193 void GetDeviceNamesUnlocked(std::vector<std::string>* output) const; |
| 194 |
186 // Returns the desktop size of the selected screen |monitor_id|. Setting | 195 // Returns the desktop size of the selected screen |monitor_id|. Setting |
187 // |monitor_id| < 0 to return the entire screen size. | 196 // |monitor_id| < 0 to return the entire screen size. |
188 DesktopSize SelectedDesktopSize(int monitor_id) const; | 197 DesktopSize SelectedDesktopSize(int monitor_id) const; |
189 | 198 |
190 // Retries DoDuplicateAll() for several times until GetNumFramesCaptured() is | 199 // Retries DoDuplicateAll() for several times until GetNumFramesCaptured() is |
191 // large enough. Returns false if DoDuplicateAll() returns false, or | 200 // large enough. Returns false if DoDuplicateAll() returns false, or |
192 // GetNumFramesCaptured() has never reached the requirement. | 201 // GetNumFramesCaptured() has never reached the requirement. |
193 // According to http://crbug.com/682112, dxgi capturer returns a black frame | 202 // According to http://crbug.com/682112, dxgi capturer returns a black frame |
194 // during first several capture attempts. | 203 // during first several capture attempts. |
195 bool EnsureFrameCaptured(Context* context, SharedDesktopFrame* target); | 204 bool EnsureFrameCaptured(Context* context, SharedDesktopFrame* target); |
(...skipping 18 matching lines...) Expand all Loading... |
214 std::vector<DxgiAdapterDuplicator> duplicators_; | 223 std::vector<DxgiAdapterDuplicator> duplicators_; |
215 D3dInfo d3d_info_; | 224 D3dInfo d3d_info_; |
216 ResolutionChangeDetector resolution_change_detector_; | 225 ResolutionChangeDetector resolution_change_detector_; |
217 // A number to indicate how many succeeded duplications have been performed. | 226 // A number to indicate how many succeeded duplications have been performed. |
218 uint32_t succeeded_duplications_ = 0; | 227 uint32_t succeeded_duplications_ = 0; |
219 }; | 228 }; |
220 | 229 |
221 } // namespace webrtc | 230 } // namespace webrtc |
222 | 231 |
223 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ | 232 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ |
OLD | NEW |