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 24 matching lines...) Expand all Loading... |
35 ~DxgiDesktopFrame() override = default; | 35 ~DxgiDesktopFrame() override = default; |
36 }; | 36 }; |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 DxgiTexture::DxgiTexture() = default; | 40 DxgiTexture::DxgiTexture() = default; |
41 DxgiTexture::~DxgiTexture() = default; | 41 DxgiTexture::~DxgiTexture() = default; |
42 | 42 |
43 bool DxgiTexture::CopyFrom(const DXGI_OUTDUPL_FRAME_INFO& frame_info, | 43 bool DxgiTexture::CopyFrom(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
44 IDXGIResource* resource) { | 44 IDXGIResource* resource) { |
45 RTC_DCHECK(resource && frame_info.AccumulatedFrames > 0); | 45 RTC_DCHECK_GT(frame_info.AccumulatedFrames, 0); |
| 46 RTC_DCHECK(resource); |
46 ComPtr<ID3D11Texture2D> texture; | 47 ComPtr<ID3D11Texture2D> texture; |
47 _com_error error = resource->QueryInterface( | 48 _com_error error = resource->QueryInterface( |
48 __uuidof(ID3D11Texture2D), | 49 __uuidof(ID3D11Texture2D), |
49 reinterpret_cast<void**>(texture.GetAddressOf())); | 50 reinterpret_cast<void**>(texture.GetAddressOf())); |
50 if (error.Error() != S_OK || !texture) { | 51 if (error.Error() != S_OK || !texture) { |
51 LOG(LS_ERROR) << "Failed to convert IDXGIResource to ID3D11Texture2D, " | 52 LOG(LS_ERROR) << "Failed to convert IDXGIResource to ID3D11Texture2D, " |
52 "error " | 53 "error " |
53 << error.ErrorMessage() << ", code " << error.Error(); | 54 << error.ErrorMessage() << ", code " << error.Error(); |
54 return false; | 55 return false; |
55 } | 56 } |
(...skipping 19 matching lines...) Expand all Loading... |
75 bool DxgiTexture::Release() { | 76 bool DxgiTexture::Release() { |
76 frame_.reset(); | 77 frame_.reset(); |
77 return DoRelease(); | 78 return DoRelease(); |
78 } | 79 } |
79 | 80 |
80 DXGI_MAPPED_RECT* DxgiTexture::rect() { | 81 DXGI_MAPPED_RECT* DxgiTexture::rect() { |
81 return &rect_; | 82 return &rect_; |
82 } | 83 } |
83 | 84 |
84 } // namespace webrtc | 85 } // namespace webrtc |
OLD | NEW |