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

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

Issue 2971393002: Output DeviceName from various windows ScreenCapturer related implementations (Closed)
Patch Set: 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
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/screen_capturer_win_directx.h" 11 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h"
12 12
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector>
15 16
16 #include "webrtc/modules/desktop_capture/desktop_frame.h" 17 #include "webrtc/modules/desktop_capture/desktop_frame.h"
17 #include "webrtc/rtc_base/checks.h" 18 #include "webrtc/rtc_base/checks.h"
18 #include "webrtc/rtc_base/logging.h" 19 #include "webrtc/rtc_base/logging.h"
19 #include "webrtc/rtc_base/ptr_util.h" 20 #include "webrtc/rtc_base/ptr_util.h"
20 #include "webrtc/rtc_base/timeutils.h" 21 #include "webrtc/rtc_base/timeutils.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 using Microsoft::WRL::ComPtr; 25 using Microsoft::WRL::ComPtr;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 (rtc::TimeNanos() - capture_start_time_nanos) / 104 (rtc::TimeNanos() - capture_start_time_nanos) /
104 rtc::kNumNanosecsPerMillisec); 105 rtc::kNumNanosecsPerMillisec);
105 frame->set_capturer_id(DesktopCapturerId::kScreenCapturerWinDirectx); 106 frame->set_capturer_id(DesktopCapturerId::kScreenCapturerWinDirectx);
106 callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); 107 callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
107 break; 108 break;
108 } 109 }
109 } 110 }
110 } 111 }
111 112
112 bool ScreenCapturerWinDirectx::GetSourceList(SourceList* sources) { 113 bool ScreenCapturerWinDirectx::GetSourceList(SourceList* sources) {
113 int screen_count = controller_->ScreenCount(); 114 std::vector<std::string> device_names;
114 for (int i = 0; i < screen_count; i++) { 115 if (!controller_->GetDeviceNames(&device_names)) {
115 sources->push_back({i}); 116 return false;
117 }
118
119 for (int i = 0; i < static_cast<int>(device_names.size()); i++) {
Do not use (sergeyu) 2017/07/11 18:21:09 Use size_t for i, then you wouldn't need the cast.
Hzj_jie 2017/07/11 19:09:25 Then we will need to convert from size_t to int in
120 sources->push_back({i, device_names[i]});
116 } 121 }
117 return true; 122 return true;
118 } 123 }
119 124
120 bool ScreenCapturerWinDirectx::SelectSource(SourceId id) { 125 bool ScreenCapturerWinDirectx::SelectSource(SourceId id) {
121 if (id == current_screen_id_) { 126 if (id == current_screen_id_) {
122 return true; 127 return true;
123 } 128 }
124 129
125 if (id == kFullDesktopScreenId) { 130 if (id == kFullDesktopScreenId) {
126 current_screen_id_ = id; 131 current_screen_id_ = id;
127 return true; 132 return true;
128 } 133 }
129 134
130 int screen_count = controller_->ScreenCount(); 135 int screen_count = controller_->ScreenCount();
131 if (id >= 0 && id < screen_count) { 136 if (id >= 0 && id < screen_count) {
132 current_screen_id_ = id; 137 current_screen_id_ = id;
133 return true; 138 return true;
134 } 139 }
135 return false; 140 return false;
136 } 141 }
137 142
138 } // namespace webrtc 143 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698