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

Side by Side Diff: webrtc/modules/desktop_capture/screen_capturer_win.cc

Issue 2709523003: BlankDetectorDesktopCapturerWrapper to detect a blank DesktopFrame (Closed)
Patch Set: Remove HISTOGRAM Created 3 years, 9 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 | « webrtc/modules/desktop_capture/rgba_color.h ('k') | no next file » | 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) 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"
14 #include "webrtc/modules/desktop_capture/desktop_capturer.h" 15 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
15 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" 16 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
16 #include "webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h" 17 #include "webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h"
18 #include "webrtc/modules/desktop_capture/rgba_color.h"
17 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" 19 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h"
18 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h" 20 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h"
19 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h" 21 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h"
20 22
21 namespace webrtc { 23 namespace webrtc {
22 24
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
23 // static 38 // static
24 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( 39 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
25 const DesktopCaptureOptions& options) { 40 const DesktopCaptureOptions& options) {
26 std::unique_ptr<DesktopCapturer> capturer; 41 std::unique_ptr<DesktopCapturer> capturer(new ScreenCapturerWinGdi(options));
27 if (options.allow_directx_capturer() && 42 if (options.allow_directx_capturer() &&
28 ScreenCapturerWinDirectx::IsSupported()) { 43 ScreenCapturerWinDirectx::IsSupported()) {
29 capturer.reset(new ScreenCapturerWinDirectx(options)); 44 capturer.reset(new FallbackDesktopCapturerWrapper(
30 } else { 45 CreateScreenCapturerWinDirectx(options), std::move(capturer)));
31 capturer.reset(new ScreenCapturerWinGdi(options));
32 } 46 }
33 47
34 if (options.allow_use_magnification_api()) { 48 if (options.allow_use_magnification_api()) {
35 // ScreenCapturerWinMagnifier cannot work on Windows XP or earlier, as well 49 // ScreenCapturerWinMagnifier cannot work on Windows XP or earlier, as well
36 // as 64-bit only Windows, and it may randomly crash on multi-screen 50 // as 64-bit only Windows, and it may randomly crash on multi-screen
37 // systems. So we may need to fallback to use original capturer. 51 // systems. So we may need to fallback to use original capturer.
38 capturer.reset(new FallbackDesktopCapturerWrapper( 52 capturer.reset(new FallbackDesktopCapturerWrapper(
39 std::unique_ptr<DesktopCapturer>(new ScreenCapturerWinMagnifier()), 53 std::unique_ptr<DesktopCapturer>(new ScreenCapturerWinMagnifier()),
40 std::move(capturer))); 54 std::move(capturer)));
41 } 55 }
42 56
43 return capturer; 57 return capturer;
44 } 58 }
45 59
46 } // namespace webrtc 60 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/rgba_color.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698