OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 <memory> | 11 #include <memory> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "webrtc/modules/desktop_capture/blank_detector_desktop_capturer_wrapper
.h" | |
15 #include "webrtc/modules/desktop_capture/desktop_capturer.h" | 14 #include "webrtc/modules/desktop_capture/desktop_capturer.h" |
16 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 15 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
17 #include "webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h" | 16 #include "webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h" |
18 #include "webrtc/modules/desktop_capture/rgba_color.h" | |
19 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" | 17 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" |
20 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" | 18 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" |
21 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" | 19 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" |
22 | 20 |
23 namespace webrtc { | 21 namespace webrtc { |
24 | 22 |
25 namespace { | |
26 | |
27 std::unique_ptr<DesktopCapturer> CreateScreenCapturerWinDirectx( | |
28 const DesktopCaptureOptions& options) { | |
29 std::unique_ptr<DesktopCapturer> capturer( | |
30 new ScreenCapturerWinDirectx(options)); | |
31 capturer.reset(new BlankDetectorDesktopCapturerWrapper( | |
32 std::move(capturer), RgbaColor(0, 0, 0, 0))); | |
33 return capturer; | |
34 } | |
35 | |
36 } // namespace | |
37 | |
38 // static | 23 // static |
39 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( | 24 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( |
40 const DesktopCaptureOptions& options) { | 25 const DesktopCaptureOptions& options) { |
41 std::unique_ptr<DesktopCapturer> capturer(new ScreenCapturerWinGdi(options)); | 26 std::unique_ptr<DesktopCapturer> capturer; |
42 if (options.allow_directx_capturer() && | 27 if (options.allow_directx_capturer() && |
43 ScreenCapturerWinDirectx::IsSupported()) { | 28 ScreenCapturerWinDirectx::IsSupported()) { |
44 capturer.reset(new FallbackDesktopCapturerWrapper( | 29 capturer.reset(new ScreenCapturerWinDirectx(options)); |
45 CreateScreenCapturerWinDirectx(options), std::move(capturer))); | 30 } else { |
| 31 capturer.reset(new ScreenCapturerWinGdi(options)); |
46 } | 32 } |
47 | 33 |
48 if (options.allow_use_magnification_api()) { | 34 if (options.allow_use_magnification_api()) { |
49 // ScreenCapturerWinMagnifier cannot work on Windows XP or earlier, as well | 35 // ScreenCapturerWinMagnifier cannot work on Windows XP or earlier, as well |
50 // as 64-bit only Windows, and it may randomly crash on multi-screen | 36 // as 64-bit only Windows, and it may randomly crash on multi-screen |
51 // systems. So we may need to fallback to use original capturer. | 37 // systems. So we may need to fallback to use original capturer. |
52 capturer.reset(new FallbackDesktopCapturerWrapper( | 38 capturer.reset(new FallbackDesktopCapturerWrapper( |
53 std::unique_ptr<DesktopCapturer>(new ScreenCapturerWinMagnifier()), | 39 std::unique_ptr<DesktopCapturer>(new ScreenCapturerWinMagnifier()), |
54 std::move(capturer))); | 40 std::move(capturer))); |
55 } | 41 } |
56 | 42 |
57 return capturer; | 43 return capturer; |
58 } | 44 } |
59 | 45 |
60 } // namespace webrtc | 46 } // namespace webrtc |
OLD | NEW |