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

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

Issue 2099123002: [Chromoting] Improve DirectX capturer to support multiple outputs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Resolve review comments Created 4 years, 4 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
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/desktop_capture/win/dxgi_texture_mapping.h"
12
13 #include <comdef.h>
14 #include <DXGI.h>
15 #include <DXGI1_2.h>
16
17 #include "webrtc/base/checks.h"
18 #include "webrtc/system_wrappers/include/logging.h"
19
20 namespace webrtc {
21
22 DxgiTextureMapping::DxgiTextureMapping(const DesktopRect& desktop_rect,
23 IDXGIOutputDuplication* duplication)
24 : DxgiTexture(desktop_rect), duplication_(duplication) {
25 RTC_DCHECK(duplication_);
26 }
27
28 bool DxgiTextureMapping::CopyFrom(const DXGI_OUTDUPL_FRAME_INFO& frame_info,
29 IDXGIResource* resource,
30 const DesktopRegion& region) {
31 RTC_DCHECK(resource && frame_info.AccumulatedFrames > 0);
32 rect_ = {0};
33 _com_error error = duplication_->MapDesktopSurface(&rect_);
34 if (error.Error() != S_OK) {
35 rect_ = {0};
36 LOG(LS_ERROR) << "Failed to map the IDXGIOutputDuplication to a bitmap, "
37 "error "
38 << error.ErrorMessage() << ", code " << error.Error();
39 return false;
40 }
41
42 return true;
43 }
44
45 bool DxgiTextureMapping::DoRelease() {
46 _com_error error = duplication_->UnMapDesktopSurface();
47 if (error.Error() != S_OK) {
48 LOG(LS_ERROR) << "Failed to unmap the IDXGIOutputDuplication, error "
49 << error.ErrorMessage() << ", code " << error.Error();
50 return false;
51 }
52 return true;
53 }
54
55 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698