tina.legrand@webrtc.org ee92b664b3 Re-organizing ACM tests
The ACM tests needed re-writing, because all tests were not individual gtests, and the result was difficult to interpret.

While doing the re-write, I discovered a bug related to 48 kHz CNG. We can't have the 48 kHz CNG active at the moment. The bug is fixed in this CL.

I also needed to rewrite parts of the VAD/DTX implementation, so that the status of VAD and DTX (enabled or not) is propagated back from the function SetVAD().

BUG=issue2173
R=minyue@webrtc.org, turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1961004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4625 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-08-27 07:33:51 +00:00

85 lines
2.0 KiB
C++

/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef TEST_VAD_DTX_H
#define TEST_VAD_DTX_H
#include "ACMTest.h"
#include "Channel.h"
#include "PCMFile.h"
namespace webrtc {
typedef struct {
bool statusDTX;
bool statusVAD;
ACMVADMode vadMode;
} VADDTXstruct;
class ActivityMonitor : public ACMVADCallback {
public:
ActivityMonitor();
~ActivityMonitor();
int32_t InFrameType(int16_t frameType);
void PrintStatistics();
void ResetStatistics();
void GetStatistics(uint32_t* getCounter);
private:
// Counting according to
// enum WebRtcACMEncodingType {
// kNoEncoding,
// kActiveNormalEncoded,
// kPassiveNormalEncoded,
// kPassiveDTXNB,
// kPassiveDTXWB,
// kPassiveDTXSWB
// };
uint32_t _counter[6];
};
class TestVADDTX : public ACMTest {
public:
TestVADDTX();
~TestVADDTX();
void Perform();
private:
// Registration can be based on codec name only, codec name and sampling
// frequency, or codec name, sampling frequency and rate.
int16_t RegisterSendCodec(char side,
char* codecName,
int32_t samplingFreqHz = -1,
int32_t rateKhz = -1);
void Run();
void OpenOutFile(int16_t testNumber);
void runTestCases();
void runTestInternalDTX(int expected_result);
void SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode);
VADDTXstruct GetVAD();
int16_t VerifyTest();
AudioCodingModule* _acmA;
AudioCodingModule* _acmB;
Channel* _channelA2B;
PCMFile _inFileA;
PCMFile _outFileB;
ActivityMonitor _monitor;
uint32_t _statCounter[6];
VADDTXstruct _setStruct;
VADDTXstruct _getStruct;
};
} // namespace webrtc
#endif