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

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

Issue 2345163002: Several minor improvements of DirectX capturer (Closed)
Patch Set: Resolve review comments Created 4 years, 3 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
Index: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
diff --git a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
index d7eb335fc3cf1e193da07b977424a38920b2fe6f..b17c195340b0e495fa6e123a2b33c06141e9a2c5 100644
--- a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
+++ b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
@@ -147,7 +147,9 @@ bool DxgiOutputDuplicator::Duplicate(Context* context,
// after it has been merged to updated_region.
DesktopRegion updated_region;
updated_region.Swap(&context->updated_region);
- if (error.Error() == S_OK && frame_info.AccumulatedFrames > 0) {
+ if (error.Error() == S_OK &&
+ frame_info.AccumulatedFrames > 0 &&
+ resource) {
DetectUpdatedRegion(frame_info, offset, &context->updated_region);
if (!texture_->CopyFrom(frame_info, resource.Get(),
context->updated_region)) {
@@ -224,8 +226,8 @@ bool DxgiOutputDuplicator::DoDetectUpdatedRegion(
DXGI_OUTDUPL_MOVE_RECT* move_rects =
reinterpret_cast<DXGI_OUTDUPL_MOVE_RECT*>(metadata.data());
size_t move_rects_count = 0;
- _com_error error = _com_error(duplication_->GetFrameMoveRects(
- static_cast<UINT>(metadata.capacity()), move_rects, &buff_size));
+ _com_error error = duplication_->GetFrameMoveRects(
+ static_cast<UINT>(metadata.capacity()), move_rects, &buff_size);
if (error.Error() != S_OK) {
LOG(LS_ERROR) << "Failed to get move rectangles, error "
<< error.ErrorMessage() << ", code " << error.Error();
@@ -235,9 +237,9 @@ bool DxgiOutputDuplicator::DoDetectUpdatedRegion(
RECT* dirty_rects = reinterpret_cast<RECT*>(metadata.data() + buff_size);
size_t dirty_rects_count = 0;
- error = _com_error(duplication_->GetFrameDirtyRects(
+ error = duplication_->GetFrameDirtyRects(
static_cast<UINT>(metadata.capacity()) - buff_size, dirty_rects,
- &buff_size));
+ &buff_size);
if (error.Error() != S_OK) {
LOG(LS_ERROR) << "Failed to get dirty rectangles, error "
<< error.ErrorMessage() << ", code " << error.Error();
« no previous file with comments | « webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h ('k') | webrtc/modules/desktop_capture/win/dxgi_texture_staging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698