• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 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 
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
13 
14 /*
15  * General declarations used through out VCM offline tests.
16  */
17 
18 #include <string>
19 
20 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/modules/include/module_common_types.h"
22 #include "webrtc/modules/video_coding/include/video_coding.h"
23 #include "webrtc/system_wrappers/include/event_wrapper.h"
24 
25 enum { kMaxNackListSize = 250 };
26 enum { kMaxPacketAgeToNack = 450 };
27 
28 class NullEvent : public webrtc::EventWrapper {
29  public:
~NullEvent()30   virtual ~NullEvent() {}
31 
Set()32   virtual bool Set() { return true; }
33 
Reset()34   virtual bool Reset() { return true; }
35 
Wait(unsigned long max_time)36   virtual webrtc::EventTypeWrapper Wait(unsigned long max_time) {  // NOLINT
37     return webrtc::kEventTimeout;
38   }
39 
StartTimer(bool periodic,unsigned long time)40   virtual bool StartTimer(bool periodic, unsigned long time) {  // NOLINT
41     return true;
42   }
43 
StopTimer()44   virtual bool StopTimer() { return true; }
45 };
46 
47 class NullEventFactory : public webrtc::EventFactory {
48  public:
~NullEventFactory()49   virtual ~NullEventFactory() {}
50 
CreateEvent()51   virtual webrtc::EventWrapper* CreateEvent() { return new NullEvent; }
52 };
53 
54 class FileOutputFrameReceiver : public webrtc::VCMReceiveCallback {
55  public:
56   FileOutputFrameReceiver(const std::string& base_out_filename, uint32_t ssrc);
57   virtual ~FileOutputFrameReceiver();
58 
59   // VCMReceiveCallback
60   virtual int32_t FrameToRender(webrtc::VideoFrame& video_frame);  // NOLINT
61 
62  private:
63   std::string out_filename_;
64   FILE* out_file_;
65   FILE* timing_file_;
66   int width_;
67   int height_;
68   int count_;
69 
70   RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FileOutputFrameReceiver);
71 };
72 
73 class 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 };
85 
86 #endif  // WEBRTC_MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
87