blob: 86d3ecfaba61883f2319bb95cb941995615804d9 [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
sakalff0e72f2017-02-07 07:15:17 -080032 bool Set() override { return true; }
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000033
sakalff0e72f2017-02-07 07:15:17 -080034 webrtc::EventTypeWrapper Wait(unsigned long max_time) override { // NOLINT
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000035 return webrtc::kEventTimeout;
36 }
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000037};
38
39class NullEventFactory : public webrtc::EventFactory {
40 public:
41 virtual ~NullEventFactory() {}
42
sakalff0e72f2017-02-07 07:15:17 -080043 webrtc::EventWrapper* CreateEvent() override { return new NullEvent; }
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000044};
mikhal@webrtc.orgd70b77d2011-08-22 21:08:15 +000045
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000046class FileOutputFrameReceiver : public webrtc::VCMReceiveCallback {
47 public:
48 FileOutputFrameReceiver(const std::string& base_out_filename, uint32_t ssrc);
49 virtual ~FileOutputFrameReceiver();
50
51 // VCMReceiveCallback
sakalff0e72f2017-02-07 07:15:17 -080052 int32_t FrameToRender(webrtc::VideoFrame& video_frame,
53 rtc::Optional<uint8_t> qp) override;
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000054
55 private:
56 std::string out_filename_;
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000057 FILE* out_file_;
58 FILE* timing_file_;
59 int width_;
60 int height_;
61 int count_;
62
henrikg3c089d72015-09-16 05:37:44 -070063 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FileOutputFrameReceiver);
solenberg@webrtc.org56b5f772013-04-16 10:31:56 +000064};
65
pbos@webrtc.orgd21406d2015-03-19 08:18:53 +000066class CmdArgs {
67 public:
68 CmdArgs();
69
70 std::string codecName;
71 webrtc::VideoCodecType codecType;
72 int width;
73 int height;
74 int rtt;
75 std::string inputFile;
76 std::string outputFile;
77};
niklase@google.com470e71d2011-07-07 08:21:25 +000078
Henrik Kjellander2557b862015-11-18 22:00:21 +010079#endif // WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_