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

Unified Diff: webrtc/modules/desktop_capture/win/dxgi_frame.cc

Issue 2827983007: Clear DesktopFrame in DxgiFrame to avoid legacy image (Closed)
Patch Set: Update comments 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 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/win/dxgi_frame.cc
diff --git a/webrtc/modules/desktop_capture/win/dxgi_frame.cc b/webrtc/modules/desktop_capture/win/dxgi_frame.cc
index 0ba678dd0ad21d24831fbff0a87dc24eebd8e3b6..6e33b64527665a007fc413a7a6bae3fcf459fda5 100644
--- a/webrtc/modules/desktop_capture/win/dxgi_frame.cc
+++ b/webrtc/modules/desktop_capture/win/dxgi_frame.cc
@@ -10,6 +10,8 @@
#include "webrtc/modules/desktop_capture/win/dxgi_frame.h"
+#include <string.h>
+
#include <utility>
#include "webrtc/base/checks.h"
@@ -46,6 +48,13 @@ bool DxgiFrame::Prepare(DesktopSize size, DesktopCapturer::SourceId source_id) {
if (!frame) {
return false;
}
+ // DirectX capturer won't paint each pixel in the frame due to its one
+ // capturer per monitor design. So once the new frame is created, we should
+ // clear it to avoid the legacy image to be remained on it. See
+ // http://crbug.com/708766.
+ RTC_DCHECK_EQ(frame->stride(),
+ frame->size().width() * DesktopFrame::kBytesPerPixel);
+ memset(frame->data(), 0, frame->stride() * frame->size().height());
frame_ = SharedDesktopFrame::Wrap(std::move(frame));
}
« 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