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