blob: f85cff305c3df57ed60de550a106f6d2b9a6056c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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.org554ae1a2011-12-16 10:09:04 +000018namespace webrtc {
19
niklase@google.com470e71d2011-07-07 08:21:25 +000020typedef struct
21{
22 bool statusDTX;
23 bool statusVAD;
24 ACMVADMode vadMode;
25} VADDTXstruct;
26
27class ActivityMonitor : public ACMVADCallback
28{
29public:
30 ActivityMonitor();
31 ~ActivityMonitor();
pbos@webrtc.org0946a562013-04-09 00:28:06 +000032 int32_t InFrameType(int16_t frameType);
niklase@google.com470e71d2011-07-07 08:21:25 +000033 void PrintStatistics(int testMode);
34 void ResetStatistics();
pbos@webrtc.org0946a562013-04-09 00:28:06 +000035 void GetStatistics(uint32_t* getCounter);
niklase@google.com470e71d2011-07-07 08:21:25 +000036private:
37 // counting according to
38 /*enum WebRtcACMEncodingType
39 {
40 kNoEncoding,
41 kActiveNormalEncoded,
42 kPassiveNormalEncoded,
43 kPassiveDTXNB,
44 kPassiveDTXWB,
45 kPassiveDTXSWB
46 };*/
pbos@webrtc.org0946a562013-04-09 00:28:06 +000047 uint32_t _counter[6];
niklase@google.com470e71d2011-07-07 08:21:25 +000048};
49
50class TestVADDTX : public ACMTest
51{
52public:
53 TestVADDTX(int testMode);
54 ~TestVADDTX();
55
56 void Perform();
57private:
58 // Registration can be based on codec name only, codec name and sampling frequency, or
59 // codec name, sampling frequency and rate.
pbos@webrtc.org0946a562013-04-09 00:28:06 +000060 int16_t RegisterSendCodec(char side,
niklase@google.com470e71d2011-07-07 08:21:25 +000061 char* codecName,
pbos@webrtc.org0946a562013-04-09 00:28:06 +000062 int32_t samplingFreqHz = -1,
63 int32_t rateKhz = -1);
niklase@google.com470e71d2011-07-07 08:21:25 +000064 void Run();
pbos@webrtc.org0946a562013-04-09 00:28:06 +000065 void OpenOutFile(int16_t testNumber);
niklase@google.com470e71d2011-07-07 08:21:25 +000066 void runTestCases();
67 void runTestInternalDTX();
pbos@webrtc.org0946a562013-04-09 00:28:06 +000068 void SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode);
niklase@google.com470e71d2011-07-07 08:21:25 +000069 VADDTXstruct GetVAD();
pbos@webrtc.org0946a562013-04-09 00:28:06 +000070 int16_t VerifyTest();//VADDTXstruct setDTX, VADDTXstruct getDTX);
niklase@google.com470e71d2011-07-07 08:21:25 +000071 AudioCodingModule* _acmA;
72 AudioCodingModule* _acmB;
73
74 Channel* _channelA2B;
75
76 PCMFile _inFileA;
77 PCMFile _outFileB;
78
79 ActivityMonitor _monitor;
pbos@webrtc.org0946a562013-04-09 00:28:06 +000080 uint32_t _statCounter[6];
niklase@google.com470e71d2011-07-07 08:21:25 +000081
82 int _testMode;
83 int _testResults;
84 VADDTXstruct _setStruct;
85 VADDTXstruct _getStruct;
86};
87
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000088} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000089
90#endif