| 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_OUTPUT_DUPLICATOR_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
| 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
| 13 | 13 |
| 14 #include <comdef.h> | 14 #include <comdef.h> |
| 15 #include <wrl/client.h> | 15 #include <wrl/client.h> |
| 16 #include <DXGI.h> | 16 #include <DXGI.h> |
| 17 #include <DXGI1_2.h> | 17 #include <DXGI1_2.h> |
| 18 | 18 |
| 19 #include <memory> | 19 #include <memory> |
| 20 #include <string> |
| 20 #include <vector> | 21 #include <vector> |
| 21 | 22 |
| 22 #include "webrtc/modules/desktop_capture/desktop_frame_rotation.h" | 23 #include "webrtc/modules/desktop_capture/desktop_frame_rotation.h" |
| 23 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 24 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| 24 #include "webrtc/modules/desktop_capture/desktop_region.h" | 25 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 25 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 26 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
| 26 #include "webrtc/modules/desktop_capture/win/d3d_device.h" | 27 #include "webrtc/modules/desktop_capture/win/d3d_device.h" |
| 27 #include "webrtc/modules/desktop_capture/win/dxgi_context.h" | 28 #include "webrtc/modules/desktop_capture/win/dxgi_context.h" |
| 28 #include "webrtc/modules/desktop_capture/win/dxgi_texture.h" | 29 #include "webrtc/modules/desktop_capture/win/dxgi_texture.h" |
| 29 #include "webrtc/rtc_base/criticalsection.h" | 30 #include "webrtc/rtc_base/criticalsection.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // function copies the content to the rectangle of (offset.x(), offset.y()) to | 62 // function copies the content to the rectangle of (offset.x(), offset.y()) to |
| 62 // (offset.x() + desktop_rect_.width(), offset.y() + desktop_rect_.height()). | 63 // (offset.x() + desktop_rect_.width(), offset.y() + desktop_rect_.height()). |
| 63 // Returns false in case of a failure. | 64 // Returns false in case of a failure. |
| 64 bool Duplicate(Context* context, | 65 bool Duplicate(Context* context, |
| 65 DesktopVector offset, | 66 DesktopVector offset, |
| 66 SharedDesktopFrame* target); | 67 SharedDesktopFrame* target); |
| 67 | 68 |
| 68 // Returns the desktop rect covered by this DxgiOutputDuplicator. | 69 // Returns the desktop rect covered by this DxgiOutputDuplicator. |
| 69 DesktopRect desktop_rect() const { return desktop_rect_; } | 70 DesktopRect desktop_rect() const { return desktop_rect_; } |
| 70 | 71 |
| 72 // Returns the device name from DXGI_OUTPUT_DESC in utf8 encoding. |
| 73 const std::string& device_name() const { return device_name_; } |
| 74 |
| 71 void Setup(Context* context); | 75 void Setup(Context* context); |
| 72 | 76 |
| 73 void Unregister(const Context* const context); | 77 void Unregister(const Context* const context); |
| 74 | 78 |
| 75 // How many frames have been captured by this DxigOutputDuplicator. | 79 // How many frames have been captured by this DxigOutputDuplicator. |
| 76 int64_t num_frames_captured() const; | 80 int64_t num_frames_captured() const; |
| 77 | 81 |
| 78 // Moves |desktop_rect_|. See DxgiDuplicatorController::TranslateRect(). | 82 // Moves |desktop_rect_|. See DxgiDuplicatorController::TranslateRect(). |
| 79 void TranslateRect(const DesktopVector& position); | 83 void TranslateRect(const DesktopVector& position); |
| 80 | 84 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 105 | 109 |
| 106 // Spreads changes from |context| to other registered Context(s) in | 110 // Spreads changes from |context| to other registered Context(s) in |
| 107 // contexts_. | 111 // contexts_. |
| 108 void SpreadContextChange(const Context* const context); | 112 void SpreadContextChange(const Context* const context); |
| 109 | 113 |
| 110 // Returns the size of desktop rectangle current instance representing. | 114 // Returns the size of desktop rectangle current instance representing. |
| 111 DesktopSize desktop_size() const; | 115 DesktopSize desktop_size() const; |
| 112 | 116 |
| 113 const D3dDevice device_; | 117 const D3dDevice device_; |
| 114 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; | 118 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; |
| 119 const std::string device_name_; |
| 115 DesktopRect desktop_rect_; | 120 DesktopRect desktop_rect_; |
| 116 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; | 121 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; |
| 117 DXGI_OUTDUPL_DESC desc_; | 122 DXGI_OUTDUPL_DESC desc_; |
| 118 std::vector<uint8_t> metadata_; | 123 std::vector<uint8_t> metadata_; |
| 119 std::unique_ptr<DxgiTexture> texture_; | 124 std::unique_ptr<DxgiTexture> texture_; |
| 120 Rotation rotation_; | 125 Rotation rotation_; |
| 121 DesktopSize unrotated_size_; | 126 DesktopSize unrotated_size_; |
| 122 | 127 |
| 123 // After each AcquireNextFrame() function call, updated_region_(s) of all | 128 // After each AcquireNextFrame() function call, updated_region_(s) of all |
| 124 // active Context(s) need to be updated. Since they have missed the | 129 // active Context(s) need to be updated. Since they have missed the |
| 125 // change this time. And during next Duplicate() function call, their | 130 // change this time. And during next Duplicate() function call, their |
| 126 // updated_region_ will be merged and copied. | 131 // updated_region_ will be merged and copied. |
| 127 std::vector<Context*> contexts_; | 132 std::vector<Context*> contexts_; |
| 128 | 133 |
| 129 // The last full frame of this output and its offset. If on AcquireNextFrame() | 134 // 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 | 135 // failed because of timeout, i.e. no update, we can copy content from |
| 131 // |last_frame_|. | 136 // |last_frame_|. |
| 132 std::unique_ptr<SharedDesktopFrame> last_frame_; | 137 std::unique_ptr<SharedDesktopFrame> last_frame_; |
| 133 DesktopVector last_frame_offset_; | 138 DesktopVector last_frame_offset_; |
| 134 | 139 |
| 135 int64_t num_frames_captured_ = 0; | 140 int64_t num_frames_captured_ = 0; |
| 136 }; | 141 }; |
| 137 | 142 |
| 138 } // namespace webrtc | 143 } // namespace webrtc |
| 139 | 144 |
| 140 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ | 145 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ |
| OLD | NEW |