blob: 30f337d2bbbdf594fec4eea448d7bc161b4e19c0 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
stefan@webrtc.org8fe03af2012-01-23 14:56:14 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
mikhal@webrtc.org105ff392011-09-23 16:41:11 +000011#ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
12#define WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
mikhal@webrtc.org105ff392011-09-23 16:41:11 +000014/*
15 * General declarations used through out VCM offline tests.
16 */
17
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000018#include <string>
niklase@google.com470e71d2011-07-07 08:21:25 +000019
henrike@webrtc.org88fbb2d2014-05-21 21:18:46 +000020#include "webrtc/base/constructormagic.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010021#include "webrtc/modules/include/module_common_types.h"
Henrik Kjellander2557b862015-11-18 22:00:21 +010022#include "webrtc/modules/video_coding/include/video_coding.h"
Henrik Kjellander98f53512015-10-28 18:17:40 +010023#include "webrtc/system_wrappers/include/event_wrapper.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000024
stefan@webrtc.orgbecf9c82013-02-01 15:09:57 +000025enum { kMaxNackListSize = 250 };
26enum { kMaxPacketAgeToNack = 450 };
27
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000028class NullEvent : public webrtc::EventWrapper {
29 public:
30 virtual ~NullEvent() {}
31
32 virtual bool Set() { return true; }
33
34 virtual bool Reset() { return true; }
35
36 virtual webrtc::EventTypeWrapper Wait(unsigned long max_time) {
37 return webrtc::kEventTimeout;
38 }
39
40 virtual bool StartTimer(bool periodic, unsigned long time) { return true; }
41
42 virtual bool StopTimer() { return true; }
43};
44
45class NullEventFactory : public webrtc::EventFactory {
46 public:
47 virtual ~NullEventFactory() {}
48
49 virtual webrtc::EventWrapper* CreateEvent() {
50 return new NullEvent;
51 }
52};
mikhal@webrtc.orgd70b77d2011-08-22 21:08:15 +000053
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000054class FileOutputFrameReceiver : public webrtc::VCMReceiveCallback {
55 public:
56 FileOutputFrameReceiver(const std::string& base_out_filename, uint32_t ssrc);
57 virtual ~FileOutputFrameReceiver();
58
59 // VCMReceiveCallback
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070060 virtual int32_t FrameToRender(webrtc::VideoFrame& video_frame);
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000061
62 private:
63 std::string out_filename_;
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000064 FILE* out_file_;
65 FILE* timing_file_;
66 int width_;
67 int height_;
68 int count_;
69
henrikg3c089d72015-09-16 05:37:44 -070070 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FileOutputFrameReceiver);
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000071};
72
pbos@webrtc.orgd21406d2015-03-19 08:18:53 +000073class CmdArgs {
74 public:
75 CmdArgs();
76
77 std::string codecName;
78 webrtc::VideoCodecType codecType;
79 int width;
80 int height;
81 int rtt;
82 std::string inputFile;
83 std::string outputFile;
84};
niklase@google.com470e71d2011-07-07 08:21:25 +000085
Henrik Kjellander2557b862015-11-18 22:00:21 +010086#endif // WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_