1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_FAKE_DESKTOP_CAPTURER_H_
6 #define REMOTING_HOST_FAKE_DESKTOP_CAPTURER_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/media_export.h"
11 #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/screen_capture_frame_queue.h"
17 // A FakeDesktopCapturer generates artificial image for testing purpose.
19 // FakeDesktopCapturer is double-buffered as required by DesktopCapturer.
20 class FakeDesktopCapturer
: public webrtc::DesktopCapturer
{
22 // By default FakeDesktopCapturer generates frames of size kWidth x kHeight,
23 // but custom frame generator set using set_frame_generator() may generate
24 // frames of different size.
25 static const int kWidth
= 800;
26 static const int kHeight
= 600;
28 typedef base::Callback
<scoped_ptr
<webrtc::DesktopFrame
>(
29 webrtc::DesktopCapturer::Callback
* callback
)> FrameGenerator
;
31 FakeDesktopCapturer();
32 virtual ~FakeDesktopCapturer();
34 void set_frame_generator(const FrameGenerator
& frame_generator
);
36 // webrtc::DesktopCapturer interface.
37 virtual void Start(Callback
* callback
) OVERRIDE
;
38 virtual void Capture(const webrtc::DesktopRegion
& rect
) OVERRIDE
;
41 FrameGenerator frame_generator_
;
45 DISALLOW_COPY_AND_ASSIGN(FakeDesktopCapturer
);
48 } // namespace remoting
50 #endif // REMOTING_HOST_FAKE_DESKTOP_CAPTURER_H_