OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ | |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ | |
13 | |
14 #include <memory> | |
15 | |
16 #include "webrtc/modules/desktop_capture/screen_capturer.h" | |
17 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | |
18 | |
19 namespace webrtc { | |
20 | |
21 // TODO(zijiehe): Remove, use DesktopCapturerDifferWrapper. | |
22 // ScreenCapturer wrapper that calculates updated_region() by comparing frames | |
23 // content. This class always expects the underlying ScreenCapturer | |
24 // implementation returns a superset of updated regions in DestkopFrame. If a | |
25 // ScreenCapturer implementation does not know the updated region, it should | |
26 // set updated_region() to full frame. | |
27 // | |
28 // This class marks entire frame as updated if the frame size or frame stride | |
29 // has been changed. | |
30 class ScreenCapturerDifferWrapper : public ScreenCapturer, | |
31 public DesktopCapturer::Callback { | |
32 public: | |
33 // Creates a ScreenCapturerDifferWrapper with a ScreenCapturer implementation, | |
34 // and takes its ownership. | |
35 explicit ScreenCapturerDifferWrapper( | |
36 std::unique_ptr<ScreenCapturer> base_capturer); | |
37 ~ScreenCapturerDifferWrapper() override; | |
38 | |
39 // ScreenCapturer interface. | |
40 void Start(DesktopCapturer::Callback* callback) override; | |
41 void SetSharedMemoryFactory( | |
42 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; | |
43 void CaptureFrame() override; | |
44 bool GetScreenList(ScreenList* screens) override; | |
45 bool SelectScreen(ScreenId id) override; | |
46 | |
47 private: | |
48 // DesktopCapturer::Callback interface. | |
49 void OnCaptureResult(Result result, | |
50 std::unique_ptr<DesktopFrame> frame) override; | |
51 | |
52 const std::unique_ptr<ScreenCapturer> base_capturer_; | |
53 DesktopCapturer::Callback* callback_; | |
54 std::unique_ptr<SharedDesktopFrame> last_frame_; | |
55 }; | |
56 | |
57 } // namespace webrtc | |
58 | |
59 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ | |
OLD | NEW |