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::Translate(). | |
79 void Translate(int32_t dx, int32_t dy); | |
Sergey Ulanov
2017/04/28 01:15:02
Maybe call it TranslateRect()?
Also make it take D
Hzj_jie
2017/04/28 01:58:32
Done.
| |
80 | |
78 private: | 81 private: |
79 // Calls DoDetectUpdatedRegion(). If it fails, this function sets the | 82 // Calls DoDetectUpdatedRegion(). If it fails, this function sets the |
80 // |updated_region| as entire UntranslatedDesktopRect(). | 83 // |updated_region| as entire UntranslatedDesktopRect(). |
81 void DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, | 84 void DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
82 DesktopRegion* updated_region); | 85 DesktopRegion* updated_region); |
83 | 86 |
84 // Returns untranslated updated region, which are directly returned by Windows | 87 // Returns untranslated updated region, which are directly returned by Windows |
85 // APIs. Returns false in case of a failure. | 88 // APIs. Returns false in case of a failure. |
86 bool DoDetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, | 89 bool DoDetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
87 DesktopRegion* updated_region); | 90 DesktopRegion* updated_region); |
(...skipping 14 matching lines...) Expand all Loading... | |
102 | 105 |
103 // Spreads changes from |context| to other registered Context(s) in | 106 // Spreads changes from |context| to other registered Context(s) in |
104 // contexts_. | 107 // contexts_. |
105 void SpreadContextChange(const Context* const context); | 108 void SpreadContextChange(const Context* const context); |
106 | 109 |
107 // Returns the size of desktop rectangle current instance representing. | 110 // Returns the size of desktop rectangle current instance representing. |
108 DesktopSize desktop_size() const; | 111 DesktopSize desktop_size() const; |
109 | 112 |
110 const D3dDevice device_; | 113 const D3dDevice device_; |
111 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; | 114 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; |
112 const DesktopRect desktop_rect_; | 115 DesktopRect desktop_rect_; |
113 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; | 116 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; |
114 DXGI_OUTDUPL_DESC desc_; | 117 DXGI_OUTDUPL_DESC desc_; |
115 std::vector<uint8_t> metadata_; | 118 std::vector<uint8_t> metadata_; |
116 std::unique_ptr<DxgiTexture> texture_; | 119 std::unique_ptr<DxgiTexture> texture_; |
117 Rotation rotation_; | 120 Rotation rotation_; |
118 DesktopSize unrotated_size_; | 121 DesktopSize unrotated_size_; |
119 | 122 |
120 // After each AcquireNextFrame() function call, updated_region_(s) of all | 123 // After each AcquireNextFrame() function call, updated_region_(s) of all |
121 // active Context(s) need to be updated. Since they have missed the | 124 // active Context(s) need to be updated. Since they have missed the |
122 // change this time. And during next Duplicate() function call, their | 125 // change this time. And during next Duplicate() function call, their |
123 // updated_region_ will be merged and copied. | 126 // updated_region_ will be merged and copied. |
124 std::vector<Context*> contexts_; | 127 std::vector<Context*> contexts_; |
125 | 128 |
126 // The last full frame of this output and its offset. If on AcquireNextFrame() | 129 // The last full frame of this output and its offset. If on AcquireNextFrame() |
127 // failed because of timeout, i.e. no update, we can copy content from | 130 // failed because of timeout, i.e. no update, we can copy content from |
128 // |last_frame_|. | 131 // |last_frame_|. |
129 std::unique_ptr<SharedDesktopFrame> last_frame_; | 132 std::unique_ptr<SharedDesktopFrame> last_frame_; |
130 DesktopVector last_frame_offset_; | 133 DesktopVector last_frame_offset_; |
131 | 134 |
132 int64_t num_frames_captured_ = 0; | 135 int64_t num_frames_captured_ = 0; |
133 }; | 136 }; |
134 | 137 |
135 } // namespace webrtc | 138 } // namespace webrtc |
136 | 139 |
137 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ | 140 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
OLD | NEW |