From cf757cf3fd9a8b66ab555665a88e2a7f5d059c07 Mon Sep 17 00:00:00 2001 From: zijiehe Date: Wed, 29 Mar 2017 14:37:53 -0700 Subject: [PATCH] ScreenCapturerWinDirectx may flicker on certain hardware Once the first capture attempt failed, we should keep the context->updated_region unchanged for next attempt. This change can (partially?) fix issue 704205. BUG=704205 Review-Url: https://codereview.webrtc.org/2780093002 Cr-Commit-Position: refs/heads/master@{#17456} --- webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc index f7a873016f..04f466455f 100644 --- a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc +++ b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc @@ -219,6 +219,10 @@ bool DxgiOutputDuplicator::Duplicate(Context* context, target->CopyPixelsFrom(*last_frame_, it.rect().top_left(), it.rect()); } target->mutable_updated_region()->AddRegion(updated_region); + } else { + // If we were at the very first frame, and capturing failed, the + // context->updated_region should be kept unchanged for next attempt. + context->updated_region.Swap(&updated_region); } // If AcquireNextFrame() failed with timeout error, we do not need to release // the frame.