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 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Returns the desktop rect covered by this DxgiOutputDuplicator. | 68 // Returns the desktop rect covered by this DxgiOutputDuplicator. |
69 DesktopRect desktop_rect() const { return desktop_rect_; } | 69 DesktopRect desktop_rect() const { return desktop_rect_; } |
70 | 70 |
71 void Setup(Context* context); | 71 void Setup(Context* context); |
72 | 72 |
73 void Unregister(const Context* const context); | 73 void Unregister(const Context* const context); |
74 | 74 |
75 // How many frames have been captured by this DxigOutputDuplicator. | 75 // How many frames have been captured by this DxigOutputDuplicator. |
76 int64_t num_frames_captured() const; | 76 int64_t num_frames_captured() const; |
77 | 77 |
78 // Moves |desktop_rect_|. See DxgiDuplicatorController::TranslateRect(). | |
79 void TranslateRect(const DesktopVector& position); | |
80 | |
81 private: | 78 private: |
82 // Calls DoDetectUpdatedRegion(). If it fails, this function sets the | 79 // Calls DoDetectUpdatedRegion(). If it fails, this function sets the |
83 // |updated_region| as entire UntranslatedDesktopRect(). | 80 // |updated_region| as entire UntranslatedDesktopRect(). |
84 void DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, | 81 void DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
85 DesktopRegion* updated_region); | 82 DesktopRegion* updated_region); |
86 | 83 |
87 // Returns untranslated updated region, which are directly returned by Windows | 84 // Returns untranslated updated region, which are directly returned by Windows |
88 // APIs. Returns false in case of a failure. | 85 // APIs. Returns false in case of a failure. |
89 bool DoDetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, | 86 bool DoDetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
90 DesktopRegion* updated_region); | 87 DesktopRegion* updated_region); |
(...skipping 14 matching lines...) Expand all Loading... |
105 | 102 |
106 // Spreads changes from |context| to other registered Context(s) in | 103 // Spreads changes from |context| to other registered Context(s) in |
107 // contexts_. | 104 // contexts_. |
108 void SpreadContextChange(const Context* const context); | 105 void SpreadContextChange(const Context* const context); |
109 | 106 |
110 // Returns the size of desktop rectangle current instance representing. | 107 // Returns the size of desktop rectangle current instance representing. |
111 DesktopSize desktop_size() const; | 108 DesktopSize desktop_size() const; |
112 | 109 |
113 const D3dDevice device_; | 110 const D3dDevice device_; |
114 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; | 111 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; |
115 DesktopRect desktop_rect_; | 112 const DesktopRect desktop_rect_; |
116 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; | 113 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; |
117 DXGI_OUTDUPL_DESC desc_; | 114 DXGI_OUTDUPL_DESC desc_; |
118 std::vector<uint8_t> metadata_; | 115 std::vector<uint8_t> metadata_; |
119 std::unique_ptr<DxgiTexture> texture_; | 116 std::unique_ptr<DxgiTexture> texture_; |
120 Rotation rotation_; | 117 Rotation rotation_; |
121 DesktopSize unrotated_size_; | 118 DesktopSize unrotated_size_; |
122 | 119 |
123 // After each AcquireNextFrame() function call, updated_region_(s) of all | 120 // After each AcquireNextFrame() function call, updated_region_(s) of all |
124 // active Context(s) need to be updated. Since they have missed the | 121 // active Context(s) need to be updated. Since they have missed the |
125 // change this time. And during next Duplicate() function call, their | 122 // change this time. And during next Duplicate() function call, their |
126 // updated_region_ will be merged and copied. | 123 // updated_region_ will be merged and copied. |
127 std::vector<Context*> contexts_; | 124 std::vector<Context*> contexts_; |
128 | 125 |
129 // The last full frame of this output and its offset. If on AcquireNextFrame() | 126 // The last full frame of this output and its offset. If on AcquireNextFrame() |
130 // failed because of timeout, i.e. no update, we can copy content from | 127 // failed because of timeout, i.e. no update, we can copy content from |
131 // |last_frame_|. | 128 // |last_frame_|. |
132 std::unique_ptr<SharedDesktopFrame> last_frame_; | 129 std::unique_ptr<SharedDesktopFrame> last_frame_; |
133 DesktopVector last_frame_offset_; | 130 DesktopVector last_frame_offset_; |
134 | 131 |
135 int64_t num_frames_captured_ = 0; | 132 int64_t num_frames_captured_ = 0; |
136 }; | 133 }; |
137 | 134 |
138 } // namespace webrtc | 135 } // namespace webrtc |
139 | 136 |
140 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ | 137 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
OLD | NEW |