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

Unified Diff: webrtc/modules/desktop_capture/window_capturer_win.cc

Issue 1705183002: Fix screen flickering for Windows platform… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/window_capturer_win.cc
diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc
index 54b2768aa803fe265d90a6b1f40884aafc795f88..dc31701790251743c0a8991be3388efc62592998 100644
--- a/webrtc/modules/desktop_capture/window_capturer_win.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_win.cc
@@ -103,6 +103,8 @@ class WindowCapturerWin : public WindowCapturer {
AeroChecker aero_checker_;
+ std::map<HWND, DesktopSize> window_size_map_;
Sergey Ulanov 2016/02/18 18:50:00 Add a comment to explain why we need to cache the
GeorgeZ 2016/02/19 23:34:48 Done.
+
RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerWin);
};
@@ -128,7 +130,11 @@ bool WindowCapturerWin::SelectWindow(WindowId id) {
if (!IsWindow(window) || !IsWindowVisible(window) || IsIconic(window))
return false;
window_ = window;
- previous_size_.set(0, 0);
+ if (window_size_map_.count(window)) {
+ previous_size_ = window_size_map_[window];
+ } else {
+ previous_size_.set(0, 0);
+ }
return true;
}
@@ -170,6 +176,7 @@ void WindowCapturerWin::Capture(const DesktopRegion& region) {
memset(frame->data(), 0, frame->stride() * frame->size().height());
previous_size_ = frame->size();
+ window_size_map_[window_] = previous_size_;
callback_->OnCaptureCompleted(frame);
return;
}
@@ -236,6 +243,7 @@ void WindowCapturerWin::Capture(const DesktopRegion& region) {
ReleaseDC(window_, window_dc);
previous_size_ = frame->size();
+ window_size_map_[window_] = previous_size_;
frame->mutable_updated_region()->SetRect(
DesktopRect::MakeSize(frame->size()));
« 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