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

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

Issue 2937663003: Ensure Dxgi duplicator works correctly in session 0 (Closed)
Patch Set: Update logs Created 3 years, 5 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
« no previous file with comments | « no previous file | webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 return true; 63 return true;
64 } 64 }
65 65
66 // static 66 // static
67 std::vector<D3dDevice> D3dDevice::EnumDevices() { 67 std::vector<D3dDevice> D3dDevice::EnumDevices() {
68 ComPtr<IDXGIFactory1> factory; 68 ComPtr<IDXGIFactory1> factory;
69 _com_error error = CreateDXGIFactory1(__uuidof(IDXGIFactory1), 69 _com_error error = CreateDXGIFactory1(__uuidof(IDXGIFactory1),
70 reinterpret_cast<void**>(factory.GetAddressOf())); 70 reinterpret_cast<void**>(factory.GetAddressOf()));
71 if (error.Error() != S_OK || !factory) { 71 if (error.Error() != S_OK || !factory) {
72 LOG(LS_WARNING) << "Cannot create IDXGIFactory1.";
72 return std::vector<D3dDevice>(); 73 return std::vector<D3dDevice>();
73 } 74 }
74 75
75 std::vector<D3dDevice> result; 76 std::vector<D3dDevice> result;
76 for (int i = 0;; i++) { 77 for (int i = 0;; i++) {
77 ComPtr<IDXGIAdapter> adapter; 78 ComPtr<IDXGIAdapter> adapter;
78 error = factory->EnumAdapters(i, adapter.GetAddressOf()); 79 error = factory->EnumAdapters(i, adapter.GetAddressOf());
79 if (error.Error() == S_OK) { 80 if (error.Error() == S_OK) {
80 D3dDevice device; 81 D3dDevice device;
81 if (!device.Initialize(adapter)) { 82 if (device.Initialize(adapter)) {
82 return std::vector<D3dDevice>(); 83 result.push_back(std::move(device));
83 } 84 }
84 result.push_back(std::move(device));
85 } else if (error.Error() == DXGI_ERROR_NOT_FOUND) { 85 } else if (error.Error() == DXGI_ERROR_NOT_FOUND) {
86 break; 86 break;
87 } else { 87 } else {
88 LOG(LS_WARNING) << "IDXGIFactory1::EnumAdapters returns an unexpected " 88 LOG(LS_WARNING) << "IDXGIFactory1::EnumAdapters returns an unexpected "
89 "error " 89 "error "
90 << error.ErrorMessage() << " with code " << error.Error(); 90 << error.ErrorMessage() << " with code " << error.Error();
91 return std::vector<D3dDevice>();
92 } 91 }
93 } 92 }
94 return result; 93 return result;
95 } 94 }
96 95
97 } // namespace webrtc 96 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698