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

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

Issue 2743233002: Ignore unmoved moved_rects in DxgiOutputDuplicator (Closed)
Patch Set: More comments and log all unmoved move_rects. 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
« 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 static_cast<UINT>(metadata_.capacity()) - buff_size, dirty_rects, 281 static_cast<UINT>(metadata_.capacity()) - buff_size, dirty_rects,
282 &buff_size); 282 &buff_size);
283 if (error.Error() != S_OK) { 283 if (error.Error() != S_OK) {
284 LOG(LS_ERROR) << "Failed to get dirty rectangles, error " 284 LOG(LS_ERROR) << "Failed to get dirty rectangles, error "
285 << error.ErrorMessage() << ", code " << error.Error(); 285 << error.ErrorMessage() << ", code " << error.Error();
286 return false; 286 return false;
287 } 287 }
288 dirty_rects_count = buff_size / sizeof(RECT); 288 dirty_rects_count = buff_size / sizeof(RECT);
289 289
290 while (move_rects_count > 0) { 290 while (move_rects_count > 0) {
291 updated_region->AddRect( 291 // DirectX capturer API may randomly return unmoved move_rects, which should
292 RotateRect(DesktopRect::MakeXYWH(move_rects->SourcePoint.x, 292 // be skipped to avoid unnecessary wasting of differing and encoding
293 move_rects->SourcePoint.y, 293 // resources.
294 move_rects->DestinationRect.right - 294 // By using testing application it2me_standalone_host_main, this check
295 move_rects->DestinationRect.left, 295 // reduces average capture time by 0.375% (4.07 -> 4.055), and average
296 move_rects->DestinationRect.bottom - 296 // encode time by 0.313% (8.042 -> 8.016) without other impacts.
297 move_rects->DestinationRect.top), 297 if (move_rects->SourcePoint.x != move_rects->DestinationRect.left ||
298 unrotated_size_, rotation_)); 298 move_rects->SourcePoint.y != move_rects->DestinationRect.top) {
299 updated_region->AddRect( 299 updated_region->AddRect(
300 RotateRect(DesktopRect::MakeLTRB(move_rects->DestinationRect.left, 300 RotateRect(DesktopRect::MakeXYWH(move_rects->SourcePoint.x,
301 move_rects->DestinationRect.top, 301 move_rects->SourcePoint.y,
302 move_rects->DestinationRect.right, 302 move_rects->DestinationRect.right -
303 move_rects->DestinationRect.bottom), 303 move_rects->DestinationRect.left,
304 unrotated_size_, rotation_)); 304 move_rects->DestinationRect.bottom -
305 move_rects->DestinationRect.top),
306 unrotated_size_, rotation_));
307 updated_region->AddRect(
308 RotateRect(DesktopRect::MakeLTRB(move_rects->DestinationRect.left,
309 move_rects->DestinationRect.top,
310 move_rects->DestinationRect.right,
311 move_rects->DestinationRect.bottom),
312 unrotated_size_, rotation_));
313 } else {
314 LOG(LS_INFO) << "Unmoved move_rect detected, ["
315 << move_rects->DestinationRect.left << ", "
316 << move_rects->DestinationRect.top << "] - ["
317 << move_rects->DestinationRect.right << ", "
318 << move_rects->DestinationRect.bottom << "].";
319 }
305 move_rects++; 320 move_rects++;
306 move_rects_count--; 321 move_rects_count--;
307 } 322 }
308 323
309 while (dirty_rects_count > 0) { 324 while (dirty_rects_count > 0) {
310 updated_region->AddRect(RotateRect( 325 updated_region->AddRect(RotateRect(
311 DesktopRect::MakeLTRB(dirty_rects->left, dirty_rects->top, 326 DesktopRect::MakeLTRB(dirty_rects->left, dirty_rects->top,
312 dirty_rects->right, dirty_rects->bottom), 327 dirty_rects->right, dirty_rects->bottom),
313 unrotated_size_, rotation_)); 328 unrotated_size_, rotation_));
314 dirty_rects++; 329 dirty_rects++;
(...skipping 28 matching lines...) Expand all
343 } 358 }
344 359
345 int64_t DxgiOutputDuplicator::num_frames_captured() const { 360 int64_t DxgiOutputDuplicator::num_frames_captured() const {
346 #if !defined(NDEBUG) 361 #if !defined(NDEBUG)
347 RTC_DCHECK_EQ(!!last_frame_, num_frames_captured_ > 0); 362 RTC_DCHECK_EQ(!!last_frame_, num_frames_captured_ > 0);
348 #endif 363 #endif
349 return num_frames_captured_; 364 return num_frames_captured_;
350 } 365 }
351 366
352 } // namespace webrtc 367 } // 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