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

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

Issue 2937663003: Ensure Dxgi duplicator works correctly in session 0 (Closed)
Patch Set: Update logs Created 3 years, 5 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
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // D3D_FEATURE_LEVEL has been retrieved from underlying OS APIs. 53 // D3D_FEATURE_LEVEL has been retrieved from underlying OS APIs.
54 D3D_FEATURE_LEVEL min_feature_level; 54 D3D_FEATURE_LEVEL min_feature_level;
55 D3D_FEATURE_LEVEL max_feature_level; 55 D3D_FEATURE_LEVEL max_feature_level;
56 56
57 // TODO(zijiehe): Add more fields, such as manufacturer name, mode, driver 57 // TODO(zijiehe): Add more fields, such as manufacturer name, mode, driver
58 // version. 58 // version.
59 }; 59 };
60 60
61 enum class Result { 61 enum class Result {
62 SUCCEEDED, 62 SUCCEEDED,
63 UNSUPPORTED_SESSION,
63 FRAME_PREPARE_FAILED, 64 FRAME_PREPARE_FAILED,
64 INITIALIZATION_FAILED, 65 INITIALIZATION_FAILED,
65 DUPLICATION_FAILED, 66 DUPLICATION_FAILED,
66 INVALID_MONITOR_ID, 67 INVALID_MONITOR_ID,
67 }; 68 };
68 69
69 // Returns the singleton instance of DxgiDuplicatorController. 70 // Returns the singleton instance of DxgiDuplicatorController.
70 static rtc::scoped_refptr<DxgiDuplicatorController> Instance(); 71 static rtc::scoped_refptr<DxgiDuplicatorController> Instance();
71 72
72 // All the following public functions implicitly call Initialize() function. 73 // All the following public functions implicitly call Initialize() function.
73 74
74 // Detects whether the system supports DXGI based capturer. 75 // Detects whether the system supports DXGI based capturer.
75 bool IsSupported(); 76 bool IsSupported();
76 77
77 // Returns a copy of D3dInfo composed by last Initialize() function call. 78 // Returns a copy of D3dInfo composed by last Initialize() function call. This
79 // function always copies the latest information into |info|. But once the
80 // function returns false, the information in |info| may not accurate.
78 bool RetrieveD3dInfo(D3dInfo* info); 81 bool RetrieveD3dInfo(D3dInfo* info);
79 82
80 // Captures current screen and writes into |frame|. 83 // Captures current screen and writes into |frame|.
81 // TODO(zijiehe): Windows cannot guarantee the frames returned by each 84 // TODO(zijiehe): Windows cannot guarantee the frames returned by each
82 // IDXGIOutputDuplication are synchronized. But we are using a totally 85 // IDXGIOutputDuplication are synchronized. But we are using a totally
83 // different threading model than the way Windows suggested, it's hard to 86 // different threading model than the way Windows suggested, it's hard to
84 // synchronize them manually. We should find a way to do it. 87 // synchronize them manually. We should find a way to do it.
85 Result Duplicate(DxgiFrame* frame); 88 Result Duplicate(DxgiFrame* frame);
86 89
87 // Captures one monitor and writes into target. |monitor_id| should >= 0. If 90 // Captures one monitor and writes into target. |monitor_id| should >= 0. If
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 rtc::CriticalSection lock_; 207 rtc::CriticalSection lock_;
205 208
206 // A self-incremented integer to compare with the one in Context. It ensures 209 // A self-incremented integer to compare with the one in Context. It ensures
207 // a Context instance is always initialized after DxgiDuplicatorController. 210 // a Context instance is always initialized after DxgiDuplicatorController.
208 int identity_ = 0; 211 int identity_ = 0;
209 DesktopRect desktop_rect_; 212 DesktopRect desktop_rect_;
210 DesktopVector dpi_; 213 DesktopVector dpi_;
211 std::vector<DxgiAdapterDuplicator> duplicators_; 214 std::vector<DxgiAdapterDuplicator> duplicators_;
212 D3dInfo d3d_info_; 215 D3dInfo d3d_info_;
213 ResolutionChangeDetector resolution_change_detector_; 216 ResolutionChangeDetector resolution_change_detector_;
217 // A number to indicate how many succeeded duplications have been performed.
218 uint32_t succeeded_duplications_ = 0;
214 }; 219 };
215 220
216 } // namespace webrtc 221 } // namespace webrtc
217 222
218 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ 223 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698