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 <memory> | 16 #include <memory> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
20 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 20 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
21 #include "webrtc/modules/desktop_capture/desktop_region.h" | 21 #include "webrtc/modules/desktop_capture/desktop_region.h" |
22 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 22 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
23 #include "webrtc/modules/desktop_capture/win/d3d_device.h" | 23 #include "webrtc/modules/desktop_capture/win/d3d_device.h" |
24 #include "webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h" | 24 #include "webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h" |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 | 27 |
28 // A controller for all the objects we need to call Windows DirectX capture APIs | 28 // A controller for all the objects we need to call Windows DirectX capture APIs |
29 // It's a singleton because, only one IDXGIOutputDuplication instance per | 29 // It's a singleton because only one IDXGIOutputDuplication instance per monitor |
30 // monitor is allowed per application. | 30 // is allowed per application. |
31 // | 31 // |
32 // Consumers should create a DxgiDuplicatorController::Context and keep it | 32 // Consumers should create a DxgiDuplicatorController::Context and keep it |
33 // throughout their lifetime, and pass it when calling Duplicate(). Consumers | 33 // throughout their lifetime, and pass it when calling Duplicate(). Consumers |
34 // can also call IsSupported() to determine whether the system supports DXGI | 34 // can also call IsSupported() to determine whether the system supports DXGI |
35 // duplicator or not. If a previous IsSupported() function call returns true, | 35 // duplicator or not. If a previous IsSupported() function call returns true, |
36 // but a later Duplicate() returns false, this usually means the display mode is | 36 // but a later Duplicate() returns false, this usually means the display mode is |
37 // changing. Consumers should retry after a while. (Typically 50 milliseconds, | 37 // changing. Consumers should retry after a while. (Typically 50 milliseconds, |
38 // but according to hardware performance, this time may vary.) | 38 // but according to hardware performance, this time may vary.) |
39 class DxgiDuplicatorController { | 39 class DxgiDuplicatorController { |
40 public: | 40 public: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // version. | 74 // version. |
75 }; | 75 }; |
76 | 76 |
77 // Returns the singleton instance of DxgiDuplicatorController. | 77 // Returns the singleton instance of DxgiDuplicatorController. |
78 static DxgiDuplicatorController* Instance(); | 78 static DxgiDuplicatorController* Instance(); |
79 | 79 |
80 // Destructs current instance. We need to make sure COM components and their | 80 // Destructs current instance. We need to make sure COM components and their |
81 // containers are destructed in correct order. | 81 // containers are destructed in correct order. |
82 ~DxgiDuplicatorController(); | 82 ~DxgiDuplicatorController(); |
83 | 83 |
84 // All the following functions implicitly call Initialize() function is | 84 // All the following functions implicitly call Initialize() function if |
85 // current instance has not been initialized. | 85 // current instance has not been initialized. |
86 | 86 |
87 // Detects whether the system supports DXGI based capturer. | 87 // Detects whether the system supports DXGI based capturer. |
88 bool IsSupported(); | 88 bool IsSupported(); |
89 | 89 |
90 // Returns a copy of D3dInfo composed by last Initialize() function call. | 90 // Returns a copy of D3dInfo composed by last Initialize() function call. |
91 bool RetrieveD3dInfo(D3dInfo* info); | 91 bool RetrieveD3dInfo(D3dInfo* info); |
92 | 92 |
93 // Captures current screen and writes into target. Since we are using double | 93 // Captures current screen and writes into target. Since we are using double |
94 // buffering, |last_frame|.updated_region() is used to represent the not | 94 // buffering, |last_frame|.updated_region() is used to represent the not |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 int identity_ = 0; | 175 int identity_ = 0; |
176 DesktopRect desktop_rect_; | 176 DesktopRect desktop_rect_; |
177 DesktopVector dpi_; | 177 DesktopVector dpi_; |
178 std::vector<DxgiAdapterDuplicator> duplicators_; | 178 std::vector<DxgiAdapterDuplicator> duplicators_; |
179 D3dInfo d3d_info_; | 179 D3dInfo d3d_info_; |
180 }; | 180 }; |
181 | 181 |
182 } // namespace webrtc | 182 } // namespace webrtc |
183 | 183 |
184 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ | 184 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ |
OLD | NEW |