blob: d1421ca85c2d1d94c2880f9242aca45a03d3b8ef [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
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000020typedef struct {
21 bool statusDTX;
22 bool statusVAD;
23 ACMVADMode vadMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000024} VADDTXstruct;
25
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000026class ActivityMonitor : public ACMVADCallback {
27 public:
28 ActivityMonitor();
29 ~ActivityMonitor();
30 int32_t InFrameType(int16_t frameType);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000031 void PrintStatistics();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000032 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.com470e71d2011-07-07 08:21:25 +000045};
46
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000047class TestVADDTX : public ACMTest {
48 public:
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000049 TestVADDTX();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000050 ~TestVADDTX();
niklase@google.com470e71d2011-07-07 08:21:25 +000051
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000052 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();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000063 void runTestInternalDTX(int expected_result);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000064 void SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode);
65 VADDTXstruct GetVAD();
66 int16_t VerifyTest();
67 AudioCodingModule* _acmA;
68 AudioCodingModule* _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000069
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000070 Channel* _channelA2B;
niklase@google.com470e71d2011-07-07 08:21:25 +000071
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000072 PCMFile _inFileA;
73 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000074
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000075 ActivityMonitor _monitor;
76 uint32_t _statCounter[6];
niklase@google.com470e71d2011-07-07 08:21:25 +000077
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000078 VADDTXstruct _setStruct;
79 VADDTXstruct _getStruct;
niklase@google.com470e71d2011-07-07 08:21:25 +000080};
81
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000082} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000083
84#endif