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

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

Issue 2703123002: Skips the first frame in DxgiDuplicatorController (Closed)
Patch Set: Resolve review comments Created 3 years, 9 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Clears all COM components referred by this instance. So next Duplicate() 164 // Clears all COM components referred by this instance. So next Duplicate()
165 // call will eventually initialize this instance again. 165 // call will eventually initialize this instance again.
166 void Deinitialize(); 166 void Deinitialize();
167 167
168 // A helper function to check whether a Context has been expired. 168 // A helper function to check whether a Context has been expired.
169 bool ContextExpired(const Context* const context) const; 169 bool ContextExpired(const Context* const context) const;
170 170
171 // Updates Context if needed. 171 // Updates Context if needed.
172 void Setup(Context* context); 172 void Setup(Context* context);
173 173
174 // Do the real duplication work. |monitor_id < 0| to capture entire screen. 174 // Does the real duplication work. |monitor_id < 0| to capture entire screen.
175 bool DoDuplicate(Context* context, 175 bool DoDuplicate(Context* context,
176 int monitor_id, 176 int monitor_id,
177 SharedDesktopFrame* target); 177 SharedDesktopFrame* target);
178 178
179 bool DoDuplicateUnlocked(Context* context, 179 bool DoDuplicateUnlocked(Context* context,
180 int monitor_id, 180 int monitor_id,
181 SharedDesktopFrame* target); 181 SharedDesktopFrame* target);
182 182
183 // Captures all monitors.
184 bool DoDuplicateAll(Context* context, SharedDesktopFrame* target);
185
186 // Captures one monitor.
187 bool DoDuplicateOne(Context* context,
188 int monitor_id,
189 SharedDesktopFrame* target);
190
191 // The minimum GetNumFramesCaptured() returned by |duplicators_|.
192 int64_t GetNumFramesCaptured() const;
193
194 int ScreenCountUnlocked();
195
196 // Retries DoDuplicateAll() for several times until GetNumFramesCaptured() is
197 // large enough. Returns false if DoDuplicateAll() returns false, or
198 // GetNumFramesCaptured() has never reached the requirement.
199 // According to http://crbug.com/682112, dxgi capturer returns a black frame
200 // during first several capture attempts.
201 bool EnsureFrameCaptured(Context* context, SharedDesktopFrame* target);
202
183 // This lock must be locked whenever accessing any of the following objects. 203 // This lock must be locked whenever accessing any of the following objects.
184 rtc::CriticalSection lock_; 204 rtc::CriticalSection lock_;
185 205
186 // A self-incremented integer to compare with the one in Context, to 206 // A self-incremented integer to compare with the one in Context, to
187 // ensure a Context has been initialized after DxgiDuplicatorController. 207 // ensure a Context has been initialized after DxgiDuplicatorController.
188 int identity_ = 0; 208 int identity_ = 0;
189 DesktopRect desktop_rect_; 209 DesktopRect desktop_rect_;
190 DesktopVector dpi_; 210 DesktopVector dpi_;
191 std::vector<DxgiAdapterDuplicator> duplicators_; 211 std::vector<DxgiAdapterDuplicator> duplicators_;
192 D3dInfo d3d_info_; 212 D3dInfo d3d_info_;
193 ResolutionChangeDetector resolution_change_detector_; 213 ResolutionChangeDetector resolution_change_detector_;
194 }; 214 };
195 215
196 } // namespace webrtc 216 } // namespace webrtc
197 217
198 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ 218 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698