blob: e0aa6b813ab6fc375615657e1a6717cd730c83b3 [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
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000011#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTVADDTX_H_
12#define WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTVADDTX_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000014#include "webrtc/modules/audio_coding/main/test/ACMTest.h"
15#include "webrtc/modules/audio_coding/main/test/Channel.h"
16#include "webrtc/modules/audio_coding/main/test/PCMFile.h"
andrew@webrtc.org89df0922013-09-12 01:27:43 +000017#include "webrtc/system_wrappers/interface/scoped_ptr.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000019namespace webrtc {
20
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000021class Config;
22
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000023typedef struct {
24 bool statusDTX;
25 bool statusVAD;
26 ACMVADMode vadMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000027} VADDTXstruct;
28
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000029class ActivityMonitor : public ACMVADCallback {
30 public:
31 ActivityMonitor();
32 ~ActivityMonitor();
33 int32_t InFrameType(int16_t frameType);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000034 void PrintStatistics();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000035 void ResetStatistics();
36 void GetStatistics(uint32_t* getCounter);
37 private:
38 // Counting according to
39 // enum WebRtcACMEncodingType {
40 // kNoEncoding,
41 // kActiveNormalEncoded,
42 // kPassiveNormalEncoded,
43 // kPassiveDTXNB,
44 // kPassiveDTXWB,
45 // kPassiveDTXSWB
46 // };
47 uint32_t _counter[6];
niklase@google.com470e71d2011-07-07 08:21:25 +000048};
49
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000050class TestVADDTX : public ACMTest {
51 public:
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000052 explicit TestVADDTX(const Config& config);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000053 ~TestVADDTX();
niklase@google.com470e71d2011-07-07 08:21:25 +000054
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000055 void Perform();
56 private:
57 // Registration can be based on codec name only, codec name and sampling
58 // frequency, or codec name, sampling frequency and rate.
59 int16_t RegisterSendCodec(char side,
60 char* codecName,
61 int32_t samplingFreqHz = -1,
62 int32_t rateKhz = -1);
63 void Run();
64 void OpenOutFile(int16_t testNumber);
65 void runTestCases();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000066 void runTestInternalDTX(int expected_result);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000067 void SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode);
68 VADDTXstruct GetVAD();
69 int16_t VerifyTest();
andrew@webrtc.org89df0922013-09-12 01:27:43 +000070 scoped_ptr<AudioCodingModule> _acmA;
71 scoped_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000072
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000073 Channel* _channelA2B;
niklase@google.com470e71d2011-07-07 08:21:25 +000074
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000075 PCMFile _inFileA;
76 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000077
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000078 ActivityMonitor _monitor;
79 uint32_t _statCounter[6];
niklase@google.com470e71d2011-07-07 08:21:25 +000080
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000081 VADDTXstruct _setStruct;
82 VADDTXstruct _getStruct;
niklase@google.com470e71d2011-07-07 08:21:25 +000083};
84
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000085} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000086
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000087#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTVADDTX_H_