| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 DxgiTextureMapping::DxgiTextureMapping(IDXGIOutputDuplication* duplication) | 22 DxgiTextureMapping::DxgiTextureMapping(IDXGIOutputDuplication* duplication) |
| 23 : duplication_(duplication) { | 23 : duplication_(duplication) { |
| 24 RTC_DCHECK(duplication_); | 24 RTC_DCHECK(duplication_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 DxgiTextureMapping::~DxgiTextureMapping() = default; | 27 DxgiTextureMapping::~DxgiTextureMapping() = default; |
| 28 | 28 |
| 29 bool DxgiTextureMapping::CopyFromTexture( | 29 bool DxgiTextureMapping::CopyFromTexture( |
| 30 const DXGI_OUTDUPL_FRAME_INFO& frame_info, | 30 const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
| 31 ID3D11Texture2D* texture) { | 31 ID3D11Texture2D* texture) { |
| 32 RTC_DCHECK(texture && frame_info.AccumulatedFrames > 0); | 32 RTC_DCHECK_GT(frame_info.AccumulatedFrames, 0); |
| 33 RTC_DCHECK(texture); |
| 33 *rect() = {0}; | 34 *rect() = {0}; |
| 34 _com_error error = duplication_->MapDesktopSurface(rect()); | 35 _com_error error = duplication_->MapDesktopSurface(rect()); |
| 35 if (error.Error() != S_OK) { | 36 if (error.Error() != S_OK) { |
| 36 *rect() = {0}; | 37 *rect() = {0}; |
| 37 LOG(LS_ERROR) << "Failed to map the IDXGIOutputDuplication to a bitmap, " | 38 LOG(LS_ERROR) << "Failed to map the IDXGIOutputDuplication to a bitmap, " |
| 38 "error " | 39 "error " |
| 39 << error.ErrorMessage() << ", code " << error.Error(); | 40 << error.ErrorMessage() << ", code " << error.Error(); |
| 40 return false; | 41 return false; |
| 41 } | 42 } |
| 42 | 43 |
| 43 return true; | 44 return true; |
| 44 } | 45 } |
| 45 | 46 |
| 46 bool DxgiTextureMapping::DoRelease() { | 47 bool DxgiTextureMapping::DoRelease() { |
| 47 _com_error error = duplication_->UnMapDesktopSurface(); | 48 _com_error error = duplication_->UnMapDesktopSurface(); |
| 48 if (error.Error() != S_OK) { | 49 if (error.Error() != S_OK) { |
| 49 LOG(LS_ERROR) << "Failed to unmap the IDXGIOutputDuplication, error " | 50 LOG(LS_ERROR) << "Failed to unmap the IDXGIOutputDuplication, error " |
| 50 << error.ErrorMessage() << ", code " << error.Error(); | 51 << error.ErrorMessage() << ", code " << error.Error(); |
| 51 return false; | 52 return false; |
| 52 } | 53 } |
| 53 return true; | 54 return true; |
| 54 } | 55 } |
| 55 | 56 |
| 56 } // namespace webrtc | 57 } // namespace webrtc |
| OLD | NEW |