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

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

Issue 2971393002: Output DeviceName from various windows ScreenCapturer related implementations (Closed)
Patch Set: Resolve review comments 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
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 int DxgiDuplicatorController::ScreenCount() { 109 int DxgiDuplicatorController::ScreenCount() {
110 rtc::CritScope lock(&lock_); 110 rtc::CritScope lock(&lock_);
111 if (Initialize()) { 111 if (Initialize()) {
112 return ScreenCountUnlocked(); 112 return ScreenCountUnlocked();
113 } 113 }
114 return 0; 114 return 0;
115 } 115 }
116 116
117 bool DxgiDuplicatorController::GetDeviceNames(
118 std::vector<std::string>* output) {
119 rtc::CritScope lock(&lock_);
120 if (Initialize()) {
121 GetDeviceNamesUnlocked(output);
122 return true;
123 }
124 return false;
125 }
126
117 DxgiDuplicatorController::Result 127 DxgiDuplicatorController::Result
118 DxgiDuplicatorController::DoDuplicate(DxgiFrame* frame, int monitor_id) { 128 DxgiDuplicatorController::DoDuplicate(DxgiFrame* frame, int monitor_id) {
119 RTC_DCHECK(frame); 129 RTC_DCHECK(frame);
120 rtc::CritScope lock(&lock_); 130 rtc::CritScope lock(&lock_);
121 131
122 // The dxgi components and APIs do not update the screen resolution without 132 // The dxgi components and APIs do not update the screen resolution without
123 // a reinitialization. So we use the GetDC() function to retrieve the screen 133 // a reinitialization. So we use the GetDC() function to retrieve the screen
124 // resolution to decide whether dxgi components need to be reinitialized. 134 // resolution to decide whether dxgi components need to be reinitialized.
125 // If the screen resolution changed, it's very likely the next Duplicate() 135 // If the screen resolution changed, it's very likely the next Duplicate()
126 // function call will fail because of a missing monitor or the frame size is 136 // function call will fail because of a missing monitor or the frame size is
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 373 }
364 374
365 int DxgiDuplicatorController::ScreenCountUnlocked() const { 375 int DxgiDuplicatorController::ScreenCountUnlocked() const {
366 int result = 0; 376 int result = 0;
367 for (auto& duplicator : duplicators_) { 377 for (auto& duplicator : duplicators_) {
368 result += duplicator.screen_count(); 378 result += duplicator.screen_count();
369 } 379 }
370 return result; 380 return result;
371 } 381 }
372 382
383 void DxgiDuplicatorController::GetDeviceNamesUnlocked(
384 std::vector<std::string>* output) const {
385 RTC_DCHECK(output);
386 for (auto& duplicator : duplicators_) {
387 for (int i = 0; i < duplicator.screen_count(); i++) {
388 output->push_back(duplicator.GetDeviceName(i));
389 }
390 }
391 }
392
373 DesktopSize DxgiDuplicatorController::SelectedDesktopSize( 393 DesktopSize DxgiDuplicatorController::SelectedDesktopSize(
374 int monitor_id) const { 394 int monitor_id) const {
375 if (monitor_id < 0) { 395 if (monitor_id < 0) {
376 return desktop_size(); 396 return desktop_size();
377 } 397 }
378 398
379 return ScreenRect(monitor_id).size(); 399 return ScreenRect(monitor_id).size();
380 } 400 }
381 401
382 bool DxgiDuplicatorController::EnsureFrameCaptured(Context* context, 402 bool DxgiDuplicatorController::EnsureFrameCaptured(Context* context,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 void DxgiDuplicatorController::TranslateRect() { 453 void DxgiDuplicatorController::TranslateRect() {
434 const DesktopVector position = 454 const DesktopVector position =
435 DesktopVector().subtract(desktop_rect_.top_left()); 455 DesktopVector().subtract(desktop_rect_.top_left());
436 desktop_rect_.Translate(position); 456 desktop_rect_.Translate(position);
437 for (auto& duplicator : duplicators_) { 457 for (auto& duplicator : duplicators_) {
438 duplicator.TranslateRect(position); 458 duplicator.TranslateRect(position);
439 } 459 }
440 } 460 }
441 461
442 } // namespace webrtc 462 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698