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 "webrtc/modules/desktop_capture/screen_capturer.h" | 11 #include "webrtc/modules/desktop_capture/screen_capturer.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 #include <set> | 16 #include <set> |
| 17 #include <utility> |
17 | 18 |
18 #include <X11/extensions/Xdamage.h> | 19 #include <X11/extensions/Xdamage.h> |
19 #include <X11/extensions/Xfixes.h> | 20 #include <X11/extensions/Xfixes.h> |
20 #include <X11/Xlib.h> | 21 #include <X11/Xlib.h> |
21 #include <X11/Xutil.h> | 22 #include <X11/Xutil.h> |
22 | 23 |
23 #include "webrtc/base/checks.h" | 24 #include "webrtc/base/checks.h" |
24 #include "webrtc/base/constructormagic.h" | 25 #include "webrtc/base/constructormagic.h" |
25 #include "webrtc/base/timeutils.h" | 26 #include "webrtc/base/timeutils.h" |
26 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 27 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
27 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 28 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
28 #include "webrtc/modules/desktop_capture/differ.h" | 29 #include "webrtc/modules/desktop_capture/differ.h" |
29 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" | 30 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" |
| 31 #include "webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h" |
30 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" | 32 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" |
31 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 33 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
32 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" | 34 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" |
33 #include "webrtc/system_wrappers/include/logging.h" | 35 #include "webrtc/system_wrappers/include/logging.h" |
34 | 36 |
35 namespace webrtc { | 37 namespace webrtc { |
36 namespace { | 38 namespace { |
37 | 39 |
38 // A class to perform video frame capturing for Linux. | 40 // A class to perform video frame capturing for Linux. |
39 class ScreenCapturerLinux : public ScreenCapturer, | 41 class ScreenCapturerLinux : public ScreenCapturer, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 421 } |
420 } | 422 } |
421 | 423 |
422 } // namespace | 424 } // namespace |
423 | 425 |
424 // static | 426 // static |
425 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) { | 427 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) { |
426 if (!options.x_display()) | 428 if (!options.x_display()) |
427 return nullptr; | 429 return nullptr; |
428 | 430 |
429 std::unique_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux()); | 431 std::unique_ptr<ScreenCapturer> capturer(new ScreenCapturerLinux()); |
430 if (!capturer->Init(options)) | 432 if (!static_cast<ScreenCapturerLinux*>(capturer.get())->Init(options)) { |
431 capturer.reset(); | 433 return nullptr; |
| 434 } |
| 435 |
| 436 if (options.detect_updated_region()) { |
| 437 capturer.reset(new ScreenCapturerDifferWrapper(std::move(capturer))); |
| 438 } |
| 439 |
432 return capturer.release(); | 440 return capturer.release(); |
433 } | 441 } |
434 | 442 |
435 } // namespace webrtc | 443 } // namespace webrtc |
OLD | NEW |