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(); |