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

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

Issue 2268093002: [WebRTC] A real ScreenCapturer test (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Resolve review comments Created 4 years, 3 months 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_ADAPTER_DUPLICATOR_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_
13 13
14 #include <wrl/client.h> 14 #include <wrl/client.h>
15 15
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/modules/desktop_capture/desktop_frame.h"
19 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 18 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
20 #include "webrtc/modules/desktop_capture/desktop_region.h" 19 #include "webrtc/modules/desktop_capture/desktop_region.h"
20 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
21 #include "webrtc/modules/desktop_capture/win/d3d_device.h" 21 #include "webrtc/modules/desktop_capture/win/d3d_device.h"
22 #include "webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h" 22 #include "webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h"
23 23
24 namespace webrtc { 24 namespace webrtc {
25 25
26 // A container of DxgiOutputDuplicators to duplicate monitors attached to a 26 // A container of DxgiOutputDuplicators to duplicate monitors attached to a
27 // single video card. 27 // single video card.
28 class DxgiAdapterDuplicator { 28 class DxgiAdapterDuplicator {
29 public: 29 public:
30 struct Context { 30 struct Context {
31 // Child DxgiOutputDuplicator::Context belongs to this 31 // Child DxgiOutputDuplicator::Context belongs to this
32 // DxgiAdapterDuplicator::Context. 32 // DxgiAdapterDuplicator::Context.
33 std::vector<DxgiOutputDuplicator::Context> contexts; 33 std::vector<DxgiOutputDuplicator::Context> contexts;
34 }; 34 };
35 35
36 // Creates an instance of DxgiAdapterDuplicator from a D3dDevice. Only 36 // Creates an instance of DxgiAdapterDuplicator from a D3dDevice. Only
37 // DxgiDuplicatorController can create an instance. 37 // DxgiDuplicatorController can create an instance.
38 explicit DxgiAdapterDuplicator(const D3dDevice& device); 38 explicit DxgiAdapterDuplicator(const D3dDevice& device);
39 39
40 // Move constructor, to make it possible to store instances of 40 // Move constructor, to make it possible to store instances of
41 // DxgiAdapterDuplicator in std::vector<>. 41 // DxgiAdapterDuplicator in std::vector<>.
42 DxgiAdapterDuplicator(DxgiAdapterDuplicator&& other); 42 DxgiAdapterDuplicator(DxgiAdapterDuplicator&& other);
43 43
44 // Initializes the DxgiAdapterDuplicator from a D3dDevice. 44 // Initializes the DxgiAdapterDuplicator from a D3dDevice.
45 bool Initialize(); 45 bool Initialize();
46 46
47 // Sequential calls Duplicate function of all the DxgiOutputDuplicators owned 47 // Sequentially calls Duplicate function of all the DxgiOutputDuplicators
48 // by this instance. 48 // owned by this instance, and writes into |target|.
49 bool Duplicate(Context* context, 49 bool Duplicate(Context* context, SharedDesktopFrame* target);
50 const DesktopFrame* last_frame,
51 DesktopFrame* target);
52 50
53 // Captures one monitor and writes into target. |monitor_id| should be between 51 // Captures one monitor and writes into |target|. |monitor_id| should be
54 // [0, screen_count()). 52 // between [0, screen_count()).
55 bool DuplicateMonitor(Context* context, 53 bool DuplicateMonitor(Context* context,
56 int monitor_id, 54 int monitor_id,
57 const DesktopFrame* last_frame, 55 SharedDesktopFrame* target);
58 DesktopFrame* target);
59 56
60 // Returns desktop rect covered by this DxgiAdapterDuplicator. 57 // Returns desktop rect covered by this DxgiAdapterDuplicator.
61 DesktopRect desktop_rect() const { return desktop_rect_; } 58 DesktopRect desktop_rect() const { return desktop_rect_; }
62 59
63 // Returns the size of one screen owned by this DxgiAdapterDuplicator. |id| 60 // Returns the size of one screen owned by this DxgiAdapterDuplicator. |id|
64 // should be between [0, screen_count()). 61 // should be between [0, screen_count()).
65 DesktopRect ScreenRect(int id) const; 62 DesktopRect ScreenRect(int id) const;
66 63
67 // Returns the count of screens owned by this DxgiAdapterDuplicator. These 64 // Returns the count of screens owned by this DxgiAdapterDuplicator. These
68 // screens can be retrieved by an interger in the range of 65 // screens can be retrieved by an interger in the range of
(...skipping 10 matching lines...) Expand all
79 void Unregister(const Context* const context); 76 void Unregister(const Context* const context);
80 77
81 const D3dDevice device_; 78 const D3dDevice device_;
82 std::vector<DxgiOutputDuplicator> duplicators_; 79 std::vector<DxgiOutputDuplicator> duplicators_;
83 DesktopRect desktop_rect_; 80 DesktopRect desktop_rect_;
84 }; 81 };
85 82
86 } // namespace webrtc 83 } // namespace webrtc
87 84
88 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_ 85 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_ADAPTER_DUPLICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698