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

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

Issue 2780093002: ScreenCapturerWinDirectx may flicker on certain hardware (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 if (last_frame_) { 214 if (last_frame_) {
215 // No change since last frame or AcquireNextFrame() timed out, we will 215 // No change since last frame or AcquireNextFrame() timed out, we will
216 // export last frame to the target. 216 // export last frame to the target.
217 for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd(); 217 for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd();
218 it.Advance()) { 218 it.Advance()) {
219 target->CopyPixelsFrom(*last_frame_, it.rect().top_left(), it.rect()); 219 target->CopyPixelsFrom(*last_frame_, it.rect().top_left(), it.rect());
220 } 220 }
221 target->mutable_updated_region()->AddRegion(updated_region); 221 target->mutable_updated_region()->AddRegion(updated_region);
222 } else {
223 // If we were at the very first frame, and capturing failed, the
224 // context->updated_region should be kept unchanged for next attempt.
225 context->updated_region.Swap(&updated_region);
222 } 226 }
223 // If AcquireNextFrame() failed with timeout error, we do not need to release 227 // If AcquireNextFrame() failed with timeout error, we do not need to release
224 // the frame. 228 // the frame.
225 return error.Error() == DXGI_ERROR_WAIT_TIMEOUT || ReleaseFrame(); 229 return error.Error() == DXGI_ERROR_WAIT_TIMEOUT || ReleaseFrame();
226 } 230 }
227 231
228 DesktopRect DxgiOutputDuplicator::TranslatedDesktopRect(DesktopVector offset) { 232 DesktopRect DxgiOutputDuplicator::TranslatedDesktopRect(DesktopVector offset) {
229 DesktopRect result(DesktopRect::MakeSize(desktop_rect_.size())); 233 DesktopRect result(DesktopRect::MakeSize(desktop_rect_.size()));
230 result.Translate(offset); 234 result.Translate(offset);
231 return result; 235 return result;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 362 }
359 363
360 int64_t DxgiOutputDuplicator::num_frames_captured() const { 364 int64_t DxgiOutputDuplicator::num_frames_captured() const {
361 #if !defined(NDEBUG) 365 #if !defined(NDEBUG)
362 RTC_DCHECK_EQ(!!last_frame_, num_frames_captured_ > 0); 366 RTC_DCHECK_EQ(!!last_frame_, num_frames_captured_ > 0);
363 #endif 367 #endif
364 return num_frames_captured_; 368 return num_frames_captured_;
365 } 369 }
366 370
367 } // namespace webrtc 371 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698