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

Side by Side Diff: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc

Issue 2345163002: Several minor improvements of DirectX capturer (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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 <DXGIFormat.h> 16 #include <DXGIFormat.h>
17 #include <Windows.h> 17 #include <Windows.h>
18 18
19 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h"
21 #include "webrtc/modules/desktop_capture/win/dxgi_texture_mapping.h" 22 #include "webrtc/modules/desktop_capture/win/dxgi_texture_mapping.h"
22 #include "webrtc/modules/desktop_capture/win/dxgi_texture_staging.h" 23 #include "webrtc/modules/desktop_capture/win/dxgi_texture_staging.h"
23 24
24 namespace webrtc { 25 namespace webrtc {
25 26
26 using Microsoft::WRL::ComPtr; 27 using Microsoft::WRL::ComPtr;
27 28
28 namespace { 29 namespace {
29 30
30 // Timeout for AcquireNextFrame() call. 31 // Timeout for AcquireNextFrame() call.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return false; 141 return false;
141 } 142 }
142 143
143 // We need to merge updated region with the one from last frame, since current 144 // We need to merge updated region with the one from last frame, since current
144 // frame contains the content one frame before. Note, this is for double 145 // frame contains the content one frame before. Note, this is for double
145 // buffering implementation, as what we have in ScreenCapturerWinDirectx. If 146 // buffering implementation, as what we have in ScreenCapturerWinDirectx. If
146 // a consumer uses single buffering, we should clear context->updated_region 147 // a consumer uses single buffering, we should clear context->updated_region
147 // after it has been merged to updated_region. 148 // after it has been merged to updated_region.
148 DesktopRegion updated_region; 149 DesktopRegion updated_region;
149 updated_region.Swap(&context->updated_region); 150 updated_region.Swap(&context->updated_region);
150 if (error.Error() == S_OK && frame_info.AccumulatedFrames > 0) { 151 if (error.Error() == S_OK &&
152 frame_info.AccumulatedFrames > 0 &&
153 resource) {
151 DetectUpdatedRegion(frame_info, offset, &context->updated_region); 154 DetectUpdatedRegion(frame_info, offset, &context->updated_region);
152 if (!texture_->CopyFrom(frame_info, resource.Get(), 155 if (!texture_->CopyFrom(frame_info, resource.Get(),
153 context->updated_region)) { 156 context->updated_region)) {
154 return false; 157 return false;
155 } 158 }
156 SpreadContextChange(context); 159 SpreadContextChange(context);
157 updated_region.AddRegion(context->updated_region); 160 updated_region.AddRegion(context->updated_region);
158 161
159 const DesktopFrame& source = texture_->AsDesktopFrame(); 162 const DesktopFrame& source = texture_->AsDesktopFrame();
160 for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd(); 163 for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 311 }
309 312
310 DesktopRect DxgiOutputDuplicator::TargetRect(DesktopRect rect, 313 DesktopRect DxgiOutputDuplicator::TargetRect(DesktopRect rect,
311 DesktopVector offset) { 314 DesktopVector offset) {
312 rect = SourceRect(rect); 315 rect = SourceRect(rect);
313 rect.Translate(offset); 316 rect.Translate(offset);
314 return rect; 317 return rect;
315 } 318 }
316 319
317 } // namespace webrtc 320 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698