Chromium Code Reviews| 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 // ScreenCapturer wrapper that calculates updated_region() by comparing frames | |
| 22 // content. | |
| 23 // | |
| 24 // This class returns entire frame as updated if the frame size or frame stride | |
| 25 // has been changed. | |
| 26 class ScreenCapturerDifferWrapper : public ScreenCapturer, | |
| 27 public DesktopCapturer::Callback { | |
| 28 public: | |
| 29 // Creates a ScreenCapturerDifferWrapper with a ScreenCapturer implementation, | |
| 30 // and takes its ownership. If |diff_entire_frame| is true, this class will | |
| 31 // assume underlying capturer won't update DesktopFrame::updated_region() by | |
| 32 // discarding it, and always compare entire frame. Otherwise, this class will | |
| 33 // use DesktopFrame::updated_region() returned by underlying capturer as hints | |
| 34 // to improve the performance to calculate the dirty region. | |
| 35 explicit ScreenCapturerDifferWrapper( | |
| 36 std::unique_ptr<ScreenCapturer> base_capturer, | |
| 37 bool diff_entire_frame); | |
|
Sergey Ulanov
2016/08/18 05:07:58
Couple ideas on how everything could work without
Hzj_jie
2016/08/23 00:54:59
Thank you for raising this issue again, I have not
| |
| 38 ~ScreenCapturerDifferWrapper() override; | |
| 39 | |
| 40 // ScreenCapturer interface. | |
| 41 void Start(DesktopCapturer::Callback* callback) override; | |
| 42 void SetSharedMemoryFactory( | |
| 43 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; | |
| 44 void Capture(const DesktopRegion& region) override; | |
| 45 bool GetScreenList(ScreenList* screens) override; | |
| 46 bool SelectScreen(ScreenId id) override; | |
| 47 | |
| 48 private: | |
| 49 // DesktopCapturer::Callback interface. | |
| 50 void OnCaptureResult(Result result, | |
| 51 std::unique_ptr<DesktopFrame> frame) override; | |
| 52 | |
| 53 const std::unique_ptr<ScreenCapturer> base_capturer_; | |
| 54 const bool diff_entire_frame_; | |
| 55 DesktopCapturer::Callback* callback_; | |
| 56 std::unique_ptr<SharedDesktopFrame> last_frame_; | |
| 57 }; | |
| 58 | |
| 59 } // namespace webrtc | |
| 60 | |
| 61 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ | |
| OLD | NEW |