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

Unified Diff: webrtc/modules/desktop_capture/win/dxgi_texture_staging.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
« no previous file with comments | « webrtc/modules/desktop_capture/win/dxgi_texture_staging.h ('k') | 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_texture_staging.cc
diff --git a/webrtc/modules/desktop_capture/win/dxgi_texture_staging.cc b/webrtc/modules/desktop_capture/win/dxgi_texture_staging.cc
index 7478728143d0d8f93c274709e5d9207fc67073d4..6866d1e4c616a7c97c2581fc6f225380ed1bb8ba 100644
--- a/webrtc/modules/desktop_capture/win/dxgi_texture_staging.cc
+++ b/webrtc/modules/desktop_capture/win/dxgi_texture_staging.cc
@@ -38,9 +38,13 @@ bool DxgiTextureStaging::InitializeStage(ID3D11Texture2D* texture) {
return false;
}
+ desc.ArraySize = 1;
desc.BindFlags = 0;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+ desc.MipLevels = 1;
desc.MiscFlags = 0;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_STAGING;
if (stage_) {
AssertStageAndSurfaceAreSameObject();
@@ -58,15 +62,15 @@ bool DxgiTextureStaging::InitializeStage(ID3D11Texture2D* texture) {
RTC_DCHECK(!surface_);
}
- _com_error error = _com_error(device_.d3d_device()->CreateTexture2D(
- &desc, nullptr, stage_.GetAddressOf()));
+ _com_error error = device_.d3d_device()->CreateTexture2D(
+ &desc, nullptr, stage_.GetAddressOf());
if (error.Error() != S_OK || !stage_) {
LOG(LS_ERROR) << "Failed to create a new ID3D11Texture2D as stage, error "
<< error.ErrorMessage() << ", code " << error.Error();
return false;
}
- error = _com_error(stage_.As(&surface_));
+ error = stage_.As(&surface_);
if (error.Error() != S_OK || !surface_) {
LOG(LS_ERROR) << "Failed to convert ID3D11Texture2D to IDXGISurface, error "
<< error.ErrorMessage() << ", code " << error.Error();
@@ -123,7 +127,7 @@ bool DxgiTextureStaging::CopyFrom(const DXGI_OUTDUPL_FRAME_INFO& frame_info,
}
rect_ = {0};
- error = _com_error(surface_->Map(&rect_, DXGI_MAP_READ));
+ error = surface_->Map(&rect_, DXGI_MAP_READ);
if (error.Error() != S_OK) {
rect_ = {0};
LOG(LS_ERROR) << "Failed to map the IDXGISurface to a bitmap, error "
@@ -135,7 +139,7 @@ bool DxgiTextureStaging::CopyFrom(const DXGI_OUTDUPL_FRAME_INFO& frame_info,
}
bool DxgiTextureStaging::DoRelease() {
- _com_error error = _com_error(surface_->Unmap());
+ _com_error error = surface_->Unmap();
if (error.Error() != S_OK) {
stage_.Reset();
surface_.Reset();
« no previous file with comments | « webrtc/modules/desktop_capture/win/dxgi_texture_staging.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698