Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 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_HOST_FAKE_DESKTOP_CAPTURER_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ |
| 6 #define REMOTING_HOST_FAKE_DESKTOP_CAPTURER_H_ | 6 #define REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 11 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 12 #include "third_party/webrtc/modules/desktop_capture/screen_capture_frame_queue. h" | 13 #include "third_party/webrtc/modules/desktop_capture/screen_capture_frame_queue. h" |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 | 16 |
| 16 // A FakeDesktopCapturer generates artificial image for testing purpose. | 17 // A FakeDesktopCapturer generates artificial image for testing purpose. |
| 17 // | 18 // |
| 18 // FakeDesktopCapturer is double-buffered as required by DesktopCapturer. | 19 // FakeDesktopCapturer is double-buffered as required by DesktopCapturer. |
| 19 class FakeDesktopCapturer : public webrtc::DesktopCapturer { | 20 class FakeDesktopCapturer : public webrtc::DesktopCapturer { |
|
kelvinp
2015/11/20 21:14:42
namespace protocol { ?
Sergey Ulanov
2015/11/21 01:41:23
Done.
| |
| 20 public: | 21 public: |
| 21 // By default FakeDesktopCapturer generates frames of size kWidth x kHeight, | 22 // By default FakeDesktopCapturer generates frames of size kWidth x kHeight, |
| 22 // but custom frame generator set using set_frame_generator() may generate | 23 // but custom frame generator set using set_frame_generator() may generate |
| 23 // frames of different size. | 24 // frames of different size. |
| 24 static const int kWidth = 800; | 25 static const int kWidth = 800; |
| 25 static const int kHeight = 600; | 26 static const int kHeight = 600; |
| 26 | 27 |
| 27 typedef base::Callback<scoped_ptr<webrtc::DesktopFrame>( | 28 typedef base::Callback<scoped_ptr<webrtc::DesktopFrame>( |
| 28 webrtc::DesktopCapturer::Callback* callback)> FrameGenerator; | 29 webrtc::DesktopCapturer::Callback* callback)> FrameGenerator; |
| 29 | 30 |
| 30 FakeDesktopCapturer(); | 31 FakeDesktopCapturer(); |
| 31 ~FakeDesktopCapturer() override; | 32 ~FakeDesktopCapturer() override; |
| 32 | 33 |
| 33 void set_frame_generator(const FrameGenerator& frame_generator); | 34 void set_frame_generator(const FrameGenerator& frame_generator); |
| 34 | 35 |
| 35 // webrtc::DesktopCapturer interface. | 36 // webrtc::DesktopCapturer interface. |
| 36 void Start(Callback* callback) override; | 37 void Start(Callback* callback) override; |
| 37 void Capture(const webrtc::DesktopRegion& rect) override; | 38 void Capture(const webrtc::DesktopRegion& rect) override; |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 FrameGenerator frame_generator_; | 41 FrameGenerator frame_generator_; |
| 41 | 42 |
| 42 Callback* callback_; | 43 Callback* callback_; |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(FakeDesktopCapturer); | 45 DISALLOW_COPY_AND_ASSIGN(FakeDesktopCapturer); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace remoting | 48 } // namespace remoting |
| 48 | 49 |
| 49 #endif // REMOTING_HOST_FAKE_DESKTOP_CAPTURER_H_ | 50 #endif // REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_ |
| OLD | NEW |