niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 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 TEST_VAD_DTX_H |
| 12 | #define TEST_VAD_DTX_H |
| 13 | |
| 14 | #include "ACMTest.h" |
| 15 | #include "Channel.h" |
| 16 | #include "PCMFile.h" |
| 17 | |
tina.legrand@webrtc.org | 554ae1a | 2011-12-16 10:09:04 +0000 | [diff] [blame] | 18 | namespace webrtc { |
| 19 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 20 | typedef struct { |
| 21 | bool statusDTX; |
| 22 | bool statusVAD; |
| 23 | ACMVADMode vadMode; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | } VADDTXstruct; |
| 25 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 26 | class ActivityMonitor : public ACMVADCallback { |
| 27 | public: |
| 28 | ActivityMonitor(); |
| 29 | ~ActivityMonitor(); |
| 30 | int32_t InFrameType(int16_t frameType); |
| 31 | void PrintStatistics(int testMode); |
| 32 | void ResetStatistics(); |
| 33 | void GetStatistics(uint32_t* getCounter); |
| 34 | private: |
| 35 | // Counting according to |
| 36 | // enum WebRtcACMEncodingType { |
| 37 | // kNoEncoding, |
| 38 | // kActiveNormalEncoded, |
| 39 | // kPassiveNormalEncoded, |
| 40 | // kPassiveDTXNB, |
| 41 | // kPassiveDTXWB, |
| 42 | // kPassiveDTXSWB |
| 43 | // }; |
| 44 | uint32_t _counter[6]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 47 | class TestVADDTX : public ACMTest { |
| 48 | public: |
| 49 | TestVADDTX(int testMode); |
| 50 | ~TestVADDTX(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 52 | void Perform(); |
| 53 | private: |
| 54 | // Registration can be based on codec name only, codec name and sampling |
| 55 | // frequency, or codec name, sampling frequency and rate. |
| 56 | int16_t RegisterSendCodec(char side, |
| 57 | char* codecName, |
| 58 | int32_t samplingFreqHz = -1, |
| 59 | int32_t rateKhz = -1); |
| 60 | void Run(); |
| 61 | void OpenOutFile(int16_t testNumber); |
| 62 | void runTestCases(); |
| 63 | void runTestInternalDTX(); |
| 64 | void SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode); |
| 65 | VADDTXstruct GetVAD(); |
| 66 | int16_t VerifyTest(); |
| 67 | AudioCodingModule* _acmA; |
| 68 | AudioCodingModule* _acmB; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 69 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 70 | Channel* _channelA2B; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 72 | PCMFile _inFileA; |
| 73 | PCMFile _outFileB; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 74 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 75 | ActivityMonitor _monitor; |
| 76 | uint32_t _statCounter[6]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 78 | int _testMode; |
| 79 | int _testResults; |
| 80 | VADDTXstruct _setStruct; |
| 81 | VADDTXstruct _getStruct; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 82 | }; |
| 83 | |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 84 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | |
| 86 | #endif |