Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h

Issue 2530303002: Use RotateDesktopFrame in DirectX capturer (Closed)
Patch Set: Sync latest changes Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector> 20 #include <vector>
21 21
22 #include "webrtc/base/criticalsection.h" 22 #include "webrtc/base/criticalsection.h"
23 #include "webrtc/base/thread_annotations.h" 23 #include "webrtc/base/thread_annotations.h"
24 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 24 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
25 #include "webrtc/modules/desktop_capture/desktop_region.h" 25 #include "webrtc/modules/desktop_capture/desktop_region.h"
26 #include "webrtc/modules/desktop_capture/desktop_frame_rotation.h"
26 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" 27 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
27 #include "webrtc/modules/desktop_capture/win/d3d_device.h" 28 #include "webrtc/modules/desktop_capture/win/d3d_device.h"
28 #include "webrtc/modules/desktop_capture/win/dxgi_texture.h" 29 #include "webrtc/modules/desktop_capture/win/dxgi_texture.h"
29 30
30 namespace webrtc { 31 namespace webrtc {
31 32
32 // Duplicates the content on one IDXGIOutput, i.e. one monitor attached to one 33 // Duplicates the content on one IDXGIOutput, i.e. one monitor attached to one
33 // video card. None of functions in this class is thread-safe. 34 // video card. None of functions in this class is thread-safe.
34 // TODO(zijiehe): Understand the meaning of rotation. 35 // TODO(zijiehe): Understand the meaning of rotation.
35 class DxgiOutputDuplicator { 36 class DxgiOutputDuplicator {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 DesktopRect TranslatedDesktopRect(DesktopVector offset); 99 DesktopRect TranslatedDesktopRect(DesktopVector offset);
99 100
100 void Setup(Context* context); 101 void Setup(Context* context);
101 102
102 void Unregister(const Context* const context); 103 void Unregister(const Context* const context);
103 104
104 // Spreads changes from |context| to other registered Context(s) in 105 // Spreads changes from |context| to other registered Context(s) in
105 // contexts_. 106 // contexts_.
106 void SpreadContextChange(const Context* const context); 107 void SpreadContextChange(const Context* const context);
107 108
108 // Returns a DesktopRect in the coordinate of |texture_|->AsDesktopFrame().
109 DesktopRect SourceRect(DesktopRect rect);
110
111 const D3dDevice device_; 109 const D3dDevice device_;
112 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; 110 const Microsoft::WRL::ComPtr<IDXGIOutput1> output_;
113 const DesktopRect desktop_rect_; 111 const DesktopRect desktop_rect_;
114 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_; 112 Microsoft::WRL::ComPtr<IDXGIOutputDuplication> duplication_;
115 DXGI_OUTDUPL_DESC desc_; 113 DXGI_OUTDUPL_DESC desc_;
116 std::vector<uint8_t> metadata; 114 std::vector<uint8_t> metadata_;
117 std::unique_ptr<DxgiTexture> texture_; 115 std::unique_ptr<DxgiTexture> texture_;
116 Rotation rotation_;
117 DesktopSize unrotated_size_;
118 118
119 // After each AcquireNextFrame() function call, updated_region_(s) of all 119 // After each AcquireNextFrame() function call, updated_region_(s) of all
120 // active Context(s) need to be updated. Since they have missed the 120 // active Context(s) need to be updated. Since they have missed the
121 // change this time. And during next Duplicate() function call, their 121 // change this time. And during next Duplicate() function call, their
122 // updated_region_ will be merged and copied. 122 // updated_region_ will be merged and copied.
123 std::vector<Context*> contexts_; 123 std::vector<Context*> contexts_;
124 124
125 // The last full frame of this output and its offset. If on AcquireNextFrame() 125 // The last full frame of this output and its offset. If on AcquireNextFrame()
126 // failed because of timeout, i.e. no update, we can copy content from 126 // failed because of timeout, i.e. no update, we can copy content from
127 // |last_frame_|. 127 // |last_frame_|.
128 std::unique_ptr<SharedDesktopFrame> last_frame_; 128 std::unique_ptr<SharedDesktopFrame> last_frame_;
129 DesktopVector last_frame_offset_; 129 DesktopVector last_frame_offset_;
130 }; 130 };
131 131
132 } // namespace webrtc 132 } // namespace webrtc
133 133
134 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_ 134 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_OUTPUT_DUPLICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698