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 MODULES_AUDIO_CODING_TEST_ISACTEST_H_ 12 #define MODULES_AUDIO_CODING_TEST_ISACTEST_H_ 13 14 #include <string.h> 15 16 #include <memory> 17 18 #include "modules/audio_coding/include/audio_coding_module.h" 19 #include "modules/audio_coding/test/Channel.h" 20 #include "modules/audio_coding/test/PCMFile.h" 21 22 namespace webrtc { 23 24 struct ACMTestISACConfig { 25 int32_t currentRateBitPerSec; 26 int16_t currentFrameSizeMsec; 27 int16_t encodingMode; 28 uint32_t initRateBitPerSec; 29 int16_t initFrameSizeInMsec; 30 bool enforceFrameSize; 31 }; 32 33 class ISACTest { 34 public: 35 ISACTest(); 36 ~ISACTest(); 37 38 void Perform(); 39 40 private: 41 class ACMTestTimer { 42 public: 43 ACMTestTimer(); 44 ~ACMTestTimer(); 45 46 void Reset(); 47 void Tick10ms(); 48 void Tick1ms(); 49 void Tick100ms(); 50 void Tick1sec(); 51 void CurrentTimeHMS(char* currTime); 52 void CurrentTime(unsigned long& h, 53 unsigned char& m, 54 unsigned char& s, 55 unsigned short& ms); 56 57 private: 58 void Adjust(); 59 60 unsigned short _msec; 61 unsigned char _sec; 62 unsigned char _min; 63 unsigned long _hour; 64 }; 65 66 void Setup(); 67 68 void Run10ms(); 69 70 void EncodeDecode(int testNr, 71 ACMTestISACConfig& wbISACConfig, 72 ACMTestISACConfig& swbISACConfig); 73 74 void SwitchingSamplingRate(int testNr, int maxSampRateChange); 75 76 std::unique_ptr<AudioCodingModule> _acmA; 77 std::unique_ptr<AudioCodingModule> _acmB; 78 79 std::unique_ptr<Channel> _channel_A2B; 80 std::unique_ptr<Channel> _channel_B2A; 81 82 PCMFile _inFileA; 83 PCMFile _inFileB; 84 85 PCMFile _outFileA; 86 PCMFile _outFileB; 87 88 std::string file_name_swb_; 89 90 ACMTestTimer _myTimer; 91 }; 92 93 } // namespace webrtc 94 95 #endif // MODULES_AUDIO_CODING_TEST_ISACTEST_H_ 96