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 // VCM Media Optimization Test 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_MEDIA_OPT_TEST_H_ 13 #define WEBRTC_MODULES_VIDEO_CODING_TEST_MEDIA_OPT_TEST_H_ 14 15 16 #include <string> 17 18 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" 19 #include "webrtc/modules/video_coding/main/interface/video_coding.h" 20 #include "webrtc/modules/video_coding/main/test/receiver_tests.h" // receive side callbacks 21 #include "webrtc/modules/video_coding/main/test/test_callbacks.h" 22 #include "webrtc/modules/video_coding/main/test/test_util.h" 23 #include "webrtc/modules/video_coding/main/test/video_source.h" 24 25 // media optimization test 26 // This test simulates a complete encode-decode cycle via the RTP module. 27 // allows error resilience tests, packet loss tests, etc. 28 // Does not test the media optimization deirectly, but via the VCM API only. 29 // The test allows two modes: 30 // 1 - Standard, basic settings, one run 31 // 2 - Release test - iterates over a number of video sequences, bit rates, packet loss values ,etc. 32 33 class MediaOptTest 34 { 35 public: 36 MediaOptTest(webrtc::VideoCodingModule* vcm, 37 webrtc::Clock* clock); 38 ~MediaOptTest(); 39 40 static int RunTest(int testNum, CmdArgs& args); 41 // perform encode-decode of an entire sequence 42 int32_t Perform(); 43 // Set up for a single mode test 44 void Setup(int testType, CmdArgs& args); 45 // General set up - applicable for both modes 46 void GeneralSetup(); 47 // Run release testing 48 void RTTest(); 49 void TearDown(); 50 // mode = 1; will print to screen, otherwise only to log file 51 void Print(int mode); 52 53 private: 54 55 webrtc::VideoCodingModule* _vcm; 56 webrtc::RtpReceiver* rtp_receiver_; 57 webrtc::RtpRtcp* _rtp; 58 webrtc::RTPSendCompleteCallback* _outgoingTransport; 59 RtpDataCallback* _dataCallback; 60 61 webrtc::Clock* _clock; 62 std::string _inname; 63 std::string _outname; 64 std::string _actualSourcename; 65 std::fstream _log; 66 FILE* _sourceFile; 67 FILE* _decodedFile; 68 FILE* _actualSourceFile; 69 FILE* _outputRes; 70 uint16_t _width; 71 uint16_t _height; 72 uint32_t _lengthSourceFrame; 73 uint32_t _timeStamp; 74 float _frameRate; 75 bool _nackEnabled; 76 bool _fecEnabled; 77 bool _nackFecEnabled; 78 uint8_t _rttMS; 79 float _bitRate; 80 double _lossRate; 81 uint32_t _renderDelayMs; 82 int32_t _frameCnt; 83 float _sumEncBytes; 84 int32_t _numFramesDropped; 85 std::string _codecName; 86 webrtc::VideoCodecType _sendCodecType; 87 int32_t _numberOfCores; 88 89 //for release test#2 90 FILE* _fpinp; 91 FILE* _fpout; 92 FILE* _fpout2; 93 int _testType; 94 int _testNum; 95 int _numParRuns; 96 97 }; // end of MediaOptTest class definition 98 99 #endif // WEBRTC_MODULES_VIDEO_CODING_TEST_MEDIA_OPT_TEST_H_ 100