 Chromium Code Reviews
 Chromium Code Reviews Issue 2314323002:
  Wrap ScreenCapturer with ScreenCapturerDifferWrapper  (Closed)
    
  
    Issue 2314323002:
  Wrap ScreenCapturer with ScreenCapturerDifferWrapper  (Closed) 
  | OLD | NEW | 
|---|---|
| 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 <utility> | 13 #include <utility> | 
| 14 | 14 | 
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" | 
| 16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" | 
| 17 #include "webrtc/base/timeutils.h" | 17 #include "webrtc/base/timeutils.h" | 
| 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 
| 19 #include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h" | |
| 19 | 20 | 
| 20 namespace webrtc { | 21 namespace webrtc { | 
| 21 | 22 | 
| 22 using Microsoft::WRL::ComPtr; | 23 using Microsoft::WRL::ComPtr; | 
| 23 | 24 | 
| 25 // static | |
| 24 bool ScreenCapturerWinDirectx::IsSupported() { | 26 bool ScreenCapturerWinDirectx::IsSupported() { | 
| 25 // Forward IsSupported function call to DxgiDuplicatorController. | 27 // Forward IsSupported function call to DxgiDuplicatorController. | 
| 26 return DxgiDuplicatorController::Instance()->IsSupported(); | 28 return DxgiDuplicatorController::Instance()->IsSupported(); | 
| 27 } | 29 } | 
| 28 | 30 | 
| 31 // static | |
| 32 std::unique_ptr<ScreenCapturer> ScreenCapturerWinDirectx::Create( | |
| 33 const DesktopCaptureOptions& options) { | |
| 34 if (!IsSupported()) { | |
| 35 return std::unique_ptr<ScreenCapturer>(); | |
| 
Sergey Ulanov
2016/09/07 22:47:23
return nullptr;
 | |
| 36 } | |
| 37 | |
| 38 // Windows is known to return larger updated region, so we wrap a | |
| 39 // ScreenCapturerDirectx instance with ScreenCapturerDifferWrapper. | |
| 40 return std::unique_ptr<ScreenCapturer>(new ScreenCapturerDifferWrapper( | |
| 
Sergey Ulanov
2016/09/07 22:47:23
I think it's better to keep this code in ScreenCap
 | |
| 41 std::unique_ptr<ScreenCapturer>(new ScreenCapturerWinDirectx(options)))); | |
| 42 } | |
| 43 | |
| 29 ScreenCapturerWinDirectx::ScreenCapturerWinDirectx( | 44 ScreenCapturerWinDirectx::ScreenCapturerWinDirectx( | 
| 30 const DesktopCaptureOptions& options) | 45 const DesktopCaptureOptions& options) | 
| 31 : callback_(nullptr) {} | 46 : callback_(nullptr) {} | 
| 32 | 47 | 
| 33 ScreenCapturerWinDirectx::~ScreenCapturerWinDirectx() {} | 48 ScreenCapturerWinDirectx::~ScreenCapturerWinDirectx() {} | 
| 34 | 49 | 
| 35 void ScreenCapturerWinDirectx::Start(Callback* callback) { | 50 void ScreenCapturerWinDirectx::Start(Callback* callback) { | 
| 36 RTC_DCHECK(!callback_); | 51 RTC_DCHECK(!callback_); | 
| 37 RTC_DCHECK(callback); | 52 RTC_DCHECK(callback); | 
| 38 | 53 | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 | 145 | 
| 131 int screen_count = DxgiDuplicatorController::Instance()->ScreenCount(); | 146 int screen_count = DxgiDuplicatorController::Instance()->ScreenCount(); | 
| 132 if (id >= 0 && id < screen_count) { | 147 if (id >= 0 && id < screen_count) { | 
| 133 current_screen_id = id; | 148 current_screen_id = id; | 
| 134 return true; | 149 return true; | 
| 135 } | 150 } | 
| 136 return false; | 151 return false; | 
| 137 } | 152 } | 
| 138 | 153 | 
| 139 } // namespace webrtc | 154 } // namespace webrtc | 
| OLD | NEW |