Invalidate the whole screen when the frame size is changed.
Otherwise we'll compare frames of different sizes and read into invalid
memory.
BUG=https://code.google.com/p/chromium/issues/detail?id=345498
R=sergeyu@chromium.org
Review URL: https://webrtc-codereview.appspot.com/9149004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5614 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/desktop_capture/screen_capturer_win.cc b/modules/desktop_capture/screen_capturer_win.cc
index 8ae755a..db0a57c 100644
--- a/modules/desktop_capture/screen_capturer_win.cc
+++ b/modules/desktop_capture/screen_capturer_win.cc
@@ -169,7 +169,7 @@
const DesktopFrame* current_frame = queue_.current_frame();
const DesktopFrame* last_frame = queue_.previous_frame();
- if (last_frame) {
+ if (last_frame && last_frame->size().equals(current_frame->size())) {
// Make sure the differencer is set up correctly for these previous and
// current screens.
if (!differ_.get() ||
@@ -188,7 +188,8 @@
®ion);
helper_.InvalidateRegion(region);
} else {
- // No previous frame is available. Invalidate the whole screen.
+ // No previous frame is available, or the screen is resized. Invalidate the
+ // whole screen.
helper_.InvalidateScreen(current_frame->size());
}