blob: de2874e5d331bc63cca2b64f8754604c968ff81e [file] [log] [blame]
pbos@webrtc.org26d12102013-05-29 13:41:03 +00001/*
2 * Copyright (c) 2013 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#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_
11#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_
12
sprang@webrtc.org131bea82015-02-18 12:46:06 +000013#include <string>
14
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000015#include "webrtc/system_wrappers/interface/scoped_ptr.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000016#include "webrtc/test/video_capturer.h"
pbos@webrtc.org26d12102013-05-29 13:41:03 +000017#include "webrtc/typedefs.h"
18
19namespace webrtc {
20
pbos@webrtc.org26d12102013-05-29 13:41:03 +000021class CriticalSectionWrapper;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000022class EventWrapper;
pbos@webrtc.org26d12102013-05-29 13:41:03 +000023class ThreadWrapper;
24
25namespace test {
26
27class FrameGenerator;
28
29class FrameGeneratorCapturer : public VideoCapturer {
30 public:
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000031 static FrameGeneratorCapturer* Create(VideoSendStreamInput* input,
andresp@webrtc.orgab654952013-09-19 12:14:03 +000032 size_t width,
33 size_t height,
34 int target_fps,
35 Clock* clock);
36
37 static FrameGeneratorCapturer* CreateFromYuvFile(VideoSendStreamInput* input,
sprang@webrtc.org131bea82015-02-18 12:46:06 +000038 const std::string& file_name,
andresp@webrtc.orgab654952013-09-19 12:14:03 +000039 size_t width,
40 size_t height,
41 int target_fps,
42 Clock* clock);
pbos@webrtc.org26d12102013-05-29 13:41:03 +000043 virtual ~FrameGeneratorCapturer();
44
45 virtual void Start() OVERRIDE;
46 virtual void Stop() OVERRIDE;
47
wu@webrtc.orgcd701192014-04-24 22:10:24 +000048 int64_t first_frame_capture_time() const { return first_frame_capture_time_; }
49
andresp@webrtc.orgab654952013-09-19 12:14:03 +000050 FrameGeneratorCapturer(Clock* clock,
51 VideoSendStreamInput* input,
pbos@webrtc.org26d12102013-05-29 13:41:03 +000052 FrameGenerator* frame_generator,
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000053 int target_fps);
pbos@webrtc.org26d12102013-05-29 13:41:03 +000054 bool Init();
sprang@webrtc.org131bea82015-02-18 12:46:06 +000055
56 private:
pbos@webrtc.org26d12102013-05-29 13:41:03 +000057 void InsertFrame();
58 static bool Run(void* obj);
59
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +000060 Clock* const clock_;
pbos@webrtc.org26d12102013-05-29 13:41:03 +000061 bool sending_;
62
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000063 scoped_ptr<EventWrapper> tick_;
64 scoped_ptr<CriticalSectionWrapper> lock_;
65 scoped_ptr<ThreadWrapper> thread_;
pbos@webrtc.org4c966012013-08-21 12:07:37 +000066 scoped_ptr<FrameGenerator> frame_generator_;
pbos@webrtc.org26d12102013-05-29 13:41:03 +000067
68 int target_fps_;
wu@webrtc.orgcd701192014-04-24 22:10:24 +000069
70 int64_t first_frame_capture_time_;
pbos@webrtc.org26d12102013-05-29 13:41:03 +000071};
72} // test
73} // webrtc
74
75#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_