blob: 5e832e4764f8cf1d2090283fec4b9f7fd824fefb [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
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000014#include "webrtc/base/scoped_ptr.h"
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000015#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.com470e71d2011-07-07 08:21:25 +000018
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000019namespace webrtc {
20
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000021typedef struct {
22 bool statusDTX;
23 bool statusVAD;
24 ACMVADMode vadMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000025} VADDTXstruct;
26
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000027class ActivityMonitor : public ACMVADCallback {
28 public:
29 ActivityMonitor();
30 ~ActivityMonitor();
31 int32_t InFrameType(int16_t frameType);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000032 void PrintStatistics();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000033 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.com470e71d2011-07-07 08:21:25 +000046};
47
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000048class TestVADDTX : public ACMTest {
49 public:
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000050 TestVADDTX();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000051 ~TestVADDTX();
niklase@google.com470e71d2011-07-07 08:21:25 +000052
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000053 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.orgee92b662013-08-27 07:33:51 +000064 void runTestInternalDTX(int expected_result);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000065 void SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode);
66 VADDTXstruct GetVAD();
67 int16_t VerifyTest();
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000068 rtc::scoped_ptr<AudioCodingModule> _acmA;
69 rtc::scoped_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000070
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000071 Channel* _channelA2B;
niklase@google.com470e71d2011-07-07 08:21:25 +000072
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000073 PCMFile _inFileA;
74 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000075
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000076 ActivityMonitor _monitor;
77 uint32_t _statCounter[6];
niklase@google.com470e71d2011-07-07 08:21:25 +000078
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000079 VADDTXstruct _setStruct;
80 VADDTXstruct _getStruct;
niklase@google.com470e71d2011-07-07 08:21:25 +000081};
82
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000083} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000084
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000085#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTVADDTX_H_