niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
stefan@webrtc.org | 8fe03af | 2012-01-23 14:56:14 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
mikhal@webrtc.org | 105ff39 | 2011-09-23 16:41:11 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_ |
| 12 | #define WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
mikhal@webrtc.org | 105ff39 | 2011-09-23 16:41:11 +0000 | [diff] [blame] | 14 | /* |
| 15 | * General declarations used through out VCM offline tests. |
| 16 | */ |
| 17 | |
solenberg@webrtc.org | 56b5f77 | 2013-04-16 10:31:56 +0000 | [diff] [blame] | 18 | #include <string> |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 19 | |
henrike@webrtc.org | 88fbb2d | 2014-05-21 21:18:46 +0000 | [diff] [blame] | 20 | #include "webrtc/base/constructormagic.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 21 | #include "webrtc/modules/include/module_common_types.h" |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 22 | #include "webrtc/modules/video_coding/include/video_coding.h" |
Henrik Kjellander | 98f5351 | 2015-10-28 18:17:40 +0100 | [diff] [blame] | 23 | #include "webrtc/system_wrappers/include/event_wrapper.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 +0000 | [diff] [blame] | 25 | enum { kMaxNackListSize = 250 }; |
| 26 | enum { kMaxPacketAgeToNack = 450 }; |
| 27 | |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 28 | class NullEvent : public webrtc::EventWrapper { |
| 29 | public: |
| 30 | virtual ~NullEvent() {} |
| 31 | |
sakal | ff0e72f | 2017-02-07 07:15:17 -0800 | [diff] [blame] | 32 | bool Set() override { return true; } |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 33 | |
sakal | ff0e72f | 2017-02-07 07:15:17 -0800 | [diff] [blame] | 34 | webrtc::EventTypeWrapper Wait(unsigned long max_time) override { // NOLINT |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 35 | return webrtc::kEventTimeout; |
| 36 | } |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | class NullEventFactory : public webrtc::EventFactory { |
| 40 | public: |
| 41 | virtual ~NullEventFactory() {} |
| 42 | |
sakal | ff0e72f | 2017-02-07 07:15:17 -0800 | [diff] [blame] | 43 | webrtc::EventWrapper* CreateEvent() override { return new NullEvent; } |
stefan@webrtc.org | 2baf5f5 | 2013-03-13 08:46:25 +0000 | [diff] [blame] | 44 | }; |
mikhal@webrtc.org | d70b77d | 2011-08-22 21:08:15 +0000 | [diff] [blame] | 45 | |
solenberg@webrtc.org | 56b5f77 | 2013-04-16 10:31:56 +0000 | [diff] [blame] | 46 | class FileOutputFrameReceiver : public webrtc::VCMReceiveCallback { |
| 47 | public: |
| 48 | FileOutputFrameReceiver(const std::string& base_out_filename, uint32_t ssrc); |
| 49 | virtual ~FileOutputFrameReceiver(); |
| 50 | |
| 51 | // VCMReceiveCallback |
sakal | ff0e72f | 2017-02-07 07:15:17 -0800 | [diff] [blame] | 52 | int32_t FrameToRender(webrtc::VideoFrame& video_frame, |
| 53 | rtc::Optional<uint8_t> qp) override; |
solenberg@webrtc.org | 56b5f77 | 2013-04-16 10:31:56 +0000 | [diff] [blame] | 54 | |
| 55 | private: |
| 56 | std::string out_filename_; |
solenberg@webrtc.org | 56b5f77 | 2013-04-16 10:31:56 +0000 | [diff] [blame] | 57 | FILE* out_file_; |
| 58 | FILE* timing_file_; |
| 59 | int width_; |
| 60 | int height_; |
| 61 | int count_; |
| 62 | |
henrikg | 3c089d7 | 2015-09-16 05:37:44 -0700 | [diff] [blame] | 63 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FileOutputFrameReceiver); |
solenberg@webrtc.org | 56b5f77 | 2013-04-16 10:31:56 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
pbos@webrtc.org | d21406d | 2015-03-19 08:18:53 +0000 | [diff] [blame] | 66 | class 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 79 | #endif // WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_ |