OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ |
6 #define REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ | 6 #define REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
13 #include "third_party/webrtc/modules/desktop_capture/screen_capture_frame_queue.
h" | 14 #include "third_party/webrtc/modules/desktop_capture/screen_capture_frame_queue.
h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 namespace protocol { | 17 namespace protocol { |
17 | 18 |
18 // A FakeDesktopCapturer generates artificial image for testing purpose. | 19 // A FakeDesktopCapturer generates artificial image for testing purpose. |
19 // | 20 // |
20 // FakeDesktopCapturer is double-buffered as required by DesktopCapturer. | 21 // FakeDesktopCapturer is double-buffered as required by DesktopCapturer. |
21 class FakeDesktopCapturer : public webrtc::DesktopCapturer { | 22 class FakeDesktopCapturer : public webrtc::DesktopCapturer { |
22 public: | 23 public: |
23 // By default FakeDesktopCapturer generates frames of size kWidth x kHeight, | 24 // By default FakeDesktopCapturer generates frames of size kWidth x kHeight, |
24 // but custom frame generator set using set_frame_generator() may generate | 25 // but custom frame generator set using set_frame_generator() may generate |
25 // frames of different size. | 26 // frames of different size. |
26 static const int kWidth = 800; | 27 static const int kWidth = 800; |
27 static const int kHeight = 600; | 28 static const int kHeight = 600; |
28 | 29 |
29 typedef base::Callback<scoped_ptr<webrtc::DesktopFrame>( | 30 typedef base::Callback<std::unique_ptr<webrtc::DesktopFrame>( |
30 webrtc::SharedMemoryFactory* shared_memory_factory)> | 31 webrtc::SharedMemoryFactory* shared_memory_factory)> |
31 FrameGenerator; | 32 FrameGenerator; |
32 | 33 |
33 FakeDesktopCapturer(); | 34 FakeDesktopCapturer(); |
34 ~FakeDesktopCapturer() override; | 35 ~FakeDesktopCapturer() override; |
35 | 36 |
36 void set_frame_generator(const FrameGenerator& frame_generator); | 37 void set_frame_generator(const FrameGenerator& frame_generator); |
37 | 38 |
38 // webrtc::DesktopCapturer interface. | 39 // webrtc::DesktopCapturer interface. |
39 void Start(Callback* callback) override; | 40 void Start(Callback* callback) override; |
40 void SetSharedMemoryFactory(rtc::scoped_ptr<webrtc::SharedMemoryFactory> | 41 void SetSharedMemoryFactory(rtc::scoped_ptr<webrtc::SharedMemoryFactory> |
41 shared_memory_factory) override; | 42 shared_memory_factory) override; |
42 void Capture(const webrtc::DesktopRegion& rect) override; | 43 void Capture(const webrtc::DesktopRegion& rect) override; |
43 | 44 |
44 private: | 45 private: |
45 FrameGenerator frame_generator_; | 46 FrameGenerator frame_generator_; |
46 | 47 |
47 Callback* callback_; | 48 Callback* callback_; |
48 | 49 |
49 scoped_ptr<webrtc::SharedMemoryFactory> shared_memory_factory_; | 50 std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory_; |
50 | 51 |
51 DISALLOW_COPY_AND_ASSIGN(FakeDesktopCapturer); | 52 DISALLOW_COPY_AND_ASSIGN(FakeDesktopCapturer); |
52 }; | 53 }; |
53 | 54 |
54 } // namespace protocol | 55 } // namespace protocol |
55 } // namespace remoting | 56 } // namespace remoting |
56 | 57 |
57 #endif // REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ | 58 #endif // REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ |
OLD | NEW |