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 |
11 #include "webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h" | 11 #include "webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <unknwn.h> | 15 #include <unknwn.h> |
16 #include <DXGI.h> | 16 #include <DXGI.h> |
17 #include <DXGIFormat.h> | 17 #include <DXGIFormat.h> |
18 #include <Windows.h> | 18 #include <Windows.h> |
19 | 19 |
20 #include <algorithm> | 20 #include <algorithm> |
21 | 21 |
22 #include "webrtc/modules/desktop_capture/win/dxgi_texture_mapping.h" | 22 #include "webrtc/modules/desktop_capture/win/dxgi_texture_mapping.h" |
23 #include "webrtc/modules/desktop_capture/win/dxgi_texture_staging.h" | 23 #include "webrtc/modules/desktop_capture/win/dxgi_texture_staging.h" |
24 #include "webrtc/rtc_base/checks.h" | 24 #include "webrtc/rtc_base/checks.h" |
25 #include "webrtc/rtc_base/logging.h" | 25 #include "webrtc/rtc_base/logging.h" |
| 26 #include "webrtc/rtc_base/win32.h" |
26 | 27 |
27 namespace webrtc { | 28 namespace webrtc { |
28 | 29 |
29 using Microsoft::WRL::ComPtr; | 30 using Microsoft::WRL::ComPtr; |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 // Timeout for AcquireNextFrame() call. | 34 // Timeout for AcquireNextFrame() call. |
34 // DxgiDuplicatorController leverages external components to do the capture | 35 // DxgiDuplicatorController leverages external components to do the capture |
35 // scheduling. So here DxgiOutputDuplicator does not need to actively wait for a | 36 // scheduling. So here DxgiOutputDuplicator does not need to actively wait for a |
(...skipping 21 matching lines...) Expand all Loading... |
57 return Rotation::CLOCK_WISE_0; | 58 return Rotation::CLOCK_WISE_0; |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
62 DxgiOutputDuplicator::DxgiOutputDuplicator(const D3dDevice& device, | 63 DxgiOutputDuplicator::DxgiOutputDuplicator(const D3dDevice& device, |
63 const ComPtr<IDXGIOutput1>& output, | 64 const ComPtr<IDXGIOutput1>& output, |
64 const DXGI_OUTPUT_DESC& desc) | 65 const DXGI_OUTPUT_DESC& desc) |
65 : device_(device), | 66 : device_(device), |
66 output_(output), | 67 output_(output), |
| 68 device_name_(rtc::ToUtf8(desc.DeviceName)), |
67 desktop_rect_(RECTToDesktopRect(desc.DesktopCoordinates)) { | 69 desktop_rect_(RECTToDesktopRect(desc.DesktopCoordinates)) { |
68 RTC_DCHECK(output_); | 70 RTC_DCHECK(output_); |
69 RTC_DCHECK(!desktop_rect_.is_empty()); | 71 RTC_DCHECK(!desktop_rect_.is_empty()); |
70 RTC_DCHECK(desktop_rect_.width() > 0 && desktop_rect_.height() > 0); | 72 RTC_DCHECK(desktop_rect_.width() > 0 && desktop_rect_.height() > 0); |
71 } | 73 } |
72 | 74 |
73 DxgiOutputDuplicator::DxgiOutputDuplicator(DxgiOutputDuplicator&& other) = | 75 DxgiOutputDuplicator::DxgiOutputDuplicator(DxgiOutputDuplicator&& other) = |
74 default; | 76 default; |
75 | 77 |
76 DxgiOutputDuplicator::~DxgiOutputDuplicator() { | 78 DxgiOutputDuplicator::~DxgiOutputDuplicator() { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 #endif | 382 #endif |
381 return num_frames_captured_; | 383 return num_frames_captured_; |
382 } | 384 } |
383 | 385 |
384 void DxgiOutputDuplicator::TranslateRect(const DesktopVector& position) { | 386 void DxgiOutputDuplicator::TranslateRect(const DesktopVector& position) { |
385 desktop_rect_.Translate(position); | 387 desktop_rect_.Translate(position); |
386 RTC_DCHECK(desktop_rect_.left() >= 0 && desktop_rect_.top() >= 0); | 388 RTC_DCHECK(desktop_rect_.left() >= 0 && desktop_rect_.top() >= 0); |
387 } | 389 } |
388 | 390 |
389 } // namespace webrtc | 391 } // namespace webrtc |
OLD | NEW |