blob: 22e9696ff567324ff1f3329dd60e0b0a12fbe0cc [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.org63a50982012-05-02 23:56:37 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000011#include "webrtc/modules/audio_coding/main/test/TestVADDTX.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000012
niklase@google.com470e71d2011-07-07 08:21:25 +000013#include <iostream>
kjellander@webrtc.org5490c712011-12-21 13:34:18 +000014
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000015#include "webrtc/common.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000016#include "webrtc/common_types.h"
17#include "webrtc/engine_configurations.h"
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000018#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000019#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
20#include "webrtc/modules/audio_coding/main/test/utility.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000021#include "webrtc/system_wrappers/interface/trace.h"
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000022#include "webrtc/test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000024namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000025
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000026TestVADDTX::TestVADDTX(const Config& config)
27 : _acmA(config.Get<AudioCodingModuleFactory>().Create(0)),
28 _acmB(config.Get<AudioCodingModuleFactory>().Create(1)),
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000029 _channelA2B(NULL) {
niklase@google.com470e71d2011-07-07 08:21:25 +000030}
31
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000032TestVADDTX::~TestVADDTX() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000033 if (_channelA2B != NULL) {
34 delete _channelA2B;
35 _channelA2B = NULL;
36 }
niklase@google.com470e71d2011-07-07 08:21:25 +000037}
38
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000039void TestVADDTX::Perform() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000040 const std::string file_name = webrtc::test::ResourcePath(
41 "audio_coding/testfile32kHz", "pcm");
42 _inFileA.Open(file_name, 32000, "rb");
43
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000044 EXPECT_EQ(0, _acmA->InitializeReceiver());
45 EXPECT_EQ(0, _acmB->InitializeReceiver());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000046
47 uint8_t numEncoders = _acmA->NumberOfCodecs();
48 CodecInst myCodecParam;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000049 for (uint8_t n = 0; n < numEncoders; n++) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000050 EXPECT_EQ(0, _acmB->Codec(n, &myCodecParam));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000051 if (!strcmp(myCodecParam.plname, "opus")) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000052 // Register Opus as mono.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000053 myCodecParam.channels = 1;
niklase@google.com470e71d2011-07-07 08:21:25 +000054 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000055 EXPECT_EQ(0, _acmB->RegisterReceiveCodec(myCodecParam));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000056 }
niklase@google.com470e71d2011-07-07 08:21:25 +000057
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000058 // Create and connect the channel
59 _channelA2B = new Channel;
60 _acmA->RegisterTransportCallback(_channelA2B);
andrew@webrtc.org89df0922013-09-12 01:27:43 +000061 _channelA2B->RegisterReceiverACM(_acmB.get());
niklase@google.com470e71d2011-07-07 08:21:25 +000062
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000063 _acmA->RegisterVADCallback(&_monitor);
niklase@google.com470e71d2011-07-07 08:21:25 +000064
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000065 int16_t testCntr = 1;
niklase@google.com470e71d2011-07-07 08:21:25 +000066
67#ifdef WEBRTC_CODEC_ISAC
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000068 // Open outputfile
69 OpenOutFile(testCntr++);
niklase@google.com470e71d2011-07-07 08:21:25 +000070
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000071 // Register iSAC WB as send codec
72 char nameISAC[] = "ISAC";
73 RegisterSendCodec('A', nameISAC, 16000);
niklase@google.com470e71d2011-07-07 08:21:25 +000074
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000075 // Run the five test cased
76 runTestCases();
niklase@google.com470e71d2011-07-07 08:21:25 +000077
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000078 // Close file
79 _outFileB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +000080
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000081 // Open outputfile
82 OpenOutFile(testCntr++);
niklase@google.com470e71d2011-07-07 08:21:25 +000083
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000084 // Register iSAC SWB as send codec
85 RegisterSendCodec('A', nameISAC, 32000);
niklase@google.com470e71d2011-07-07 08:21:25 +000086
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000087 // Run the five test cased
88 runTestCases();
niklase@google.com470e71d2011-07-07 08:21:25 +000089
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000090 // Close file
91 _outFileB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +000092#endif
93#ifdef WEBRTC_CODEC_ILBC
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000094 // Open outputfile
95 OpenOutFile(testCntr++);
niklase@google.com470e71d2011-07-07 08:21:25 +000096
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000097 // Register iLBC as send codec
98 char nameILBC[] = "ilbc";
99 RegisterSendCodec('A', nameILBC);
niklase@google.com470e71d2011-07-07 08:21:25 +0000100
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000101 // Run the five test cased
102 runTestCases();
niklase@google.com470e71d2011-07-07 08:21:25 +0000103
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000104 // Close file
105 _outFileB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000106
107#endif
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000108#ifdef WEBRTC_CODEC_OPUS
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000109 // Open outputfile
110 OpenOutFile(testCntr++);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000111
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000112 // Register Opus as send codec
113 char nameOPUS[] = "opus";
114 RegisterSendCodec('A', nameOPUS);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000115
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000116 // Run the five test cased
117 runTestCases();
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000118
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000119 // Close file
120 _outFileB.Close();
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000121
122#endif
niklase@google.com470e71d2011-07-07 08:21:25 +0000123}
124
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000125void TestVADDTX::runTestCases() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000126 // #1 DTX = OFF, VAD = ON, VADNormal
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000127 SetVAD(false, true, VADNormal);
128 Run();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000129 VerifyTest();
niklase@google.com470e71d2011-07-07 08:21:25 +0000130
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000131 // #2 DTX = OFF, VAD = ON, VADAggr
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000132 SetVAD(false, true, VADAggr);
133 Run();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000134 VerifyTest();
niklase@google.com470e71d2011-07-07 08:21:25 +0000135
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000136 // #3 DTX = ON, VAD = ON, VADLowBitrate
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000137 SetVAD(true, true, VADLowBitrate);
138 Run();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000139 VerifyTest();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000140
141 // #4 DTX = ON, VAD = ON, VADVeryAggr
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000142 SetVAD(true, true, VADVeryAggr);
143 Run();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000144 VerifyTest();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000145
146 // #5 DTX = ON, VAD = OFF, VADNormal
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000147 SetVAD(true, false, VADNormal);
148 Run();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000149 VerifyTest();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000150}
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000151
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000152void TestVADDTX::runTestInternalDTX(int expected_result) {
153 // #6 DTX = ON, VAD = ON, VADNormal
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000154 SetVAD(true, true, VADNormal);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000155 EXPECT_EQ(expected_result, _acmA->ReplaceInternalDTXWithWebRtc(true));
156 if (expected_result == 0) {
157 Run();
158 VerifyTest();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000159 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000160}
161
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000162void TestVADDTX::SetVAD(bool statusDTX, bool statusVAD, int16_t vadMode) {
163 bool dtxEnabled, vadEnabled;
164 ACMVADMode vadModeSet;
niklase@google.com470e71d2011-07-07 08:21:25 +0000165
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000166 EXPECT_EQ(0, _acmA->SetVAD(statusDTX, statusVAD, (ACMVADMode) vadMode));
167 EXPECT_EQ(0, _acmA->VAD(&dtxEnabled, &vadEnabled, &vadModeSet));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000168
169 // Requested VAD/DTX settings
170 _setStruct.statusDTX = statusDTX;
171 _setStruct.statusVAD = statusVAD;
172 _setStruct.vadMode = (ACMVADMode) vadMode;
173
174 // VAD settings after setting VAD in ACM
175 _getStruct.statusDTX = dtxEnabled;
176 _getStruct.statusVAD = vadEnabled;
177 _getStruct.vadMode = vadModeSet;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000178}
179
180VADDTXstruct TestVADDTX::GetVAD() {
181 VADDTXstruct retStruct;
182 bool dtxEnabled, vadEnabled;
183 ACMVADMode vadModeSet;
184
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000185 EXPECT_EQ(0, _acmA->VAD(&dtxEnabled, &vadEnabled, &vadModeSet));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000186
187 retStruct.statusDTX = dtxEnabled;
188 retStruct.statusVAD = vadEnabled;
189 retStruct.vadMode = vadModeSet;
190 return retStruct;
191}
192
193int16_t TestVADDTX::RegisterSendCodec(char side, char* codecName,
194 int32_t samplingFreqHz,
195 int32_t rateKbps) {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000196 std::cout << std::flush;
197 AudioCodingModule* myACM;
198 switch (side) {
199 case 'A': {
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000200 myACM = _acmA.get();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000201 break;
202 }
203 case 'B': {
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000204 myACM = _acmB.get();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000205 break;
206 }
207 default:
208 return -1;
209 }
210
211 if (myACM == NULL) {
212 return -1;
213 }
214
215 CodecInst myCodecParam;
216 for (int16_t codecCntr = 0; codecCntr < myACM->NumberOfCodecs();
217 codecCntr++) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000218 EXPECT_EQ(0, myACM->Codec((uint8_t) codecCntr, &myCodecParam));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000219 if (!STR_CASE_CMP(myCodecParam.plname, codecName)) {
220 if ((samplingFreqHz == -1) || (myCodecParam.plfreq == samplingFreqHz)) {
221 if ((rateKbps == -1) || (myCodecParam.rate == rateKbps)) {
222 break;
223 }
224 }
225 }
226 }
227
228 // We only allow VAD/DTX when sending mono.
229 myCodecParam.channels = 1;
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000230 EXPECT_EQ(0, myACM->RegisterSendCodec(myCodecParam));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000231
232 // initialization was succesful
233 return 0;
234}
235
236void TestVADDTX::Run() {
237 AudioFrame audioFrame;
238
239 uint16_t SamplesIn10MsecA = _inFileA.PayloadLength10Ms();
240 uint32_t timestampA = 1;
241 int32_t outFreqHzB = _outFileB.SamplingFrequency();
242
243 while (!_inFileA.EndOfFile()) {
244 _inFileA.Read10MsData(audioFrame);
245 audioFrame.timestamp_ = timestampA;
246 timestampA += SamplesIn10MsecA;
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000247 EXPECT_EQ(0, _acmA->Add10MsData(audioFrame));
248 EXPECT_GT(_acmA->Process(), -1);
249 EXPECT_EQ(0, _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000250 _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
251 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000252#ifdef PRINT_STAT
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000253 _monitor.PrintStatistics();
niklase@google.com470e71d2011-07-07 08:21:25 +0000254#endif
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000255 _inFileA.Rewind();
256 _monitor.GetStatistics(_statCounter);
257 _monitor.ResetStatistics();
niklase@google.com470e71d2011-07-07 08:21:25 +0000258}
259
pbos@webrtc.org0946a562013-04-09 00:28:06 +0000260void TestVADDTX::OpenOutFile(int16_t test_number) {
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000261 std::string file_name;
262 std::stringstream file_stream;
263 file_stream << webrtc::test::OutputPath();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000264 file_stream << "testVADDTX_outFile_";
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000265 file_stream << test_number << ".pcm";
266 file_name = file_stream.str();
267 _outFileB.Open(file_name, 16000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000268}
269
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000270int16_t TestVADDTX::VerifyTest() {
271 // Verify empty frame result
272 uint8_t statusEF = 0;
273 uint8_t vadPattern = 0;
274 uint8_t emptyFramePattern[6];
275 CodecInst myCodecParam;
276 _acmA->SendCodec(&myCodecParam);
277 bool dtxInUse = true;
278 bool isReplaced = false;
279 if ((STR_CASE_CMP(myCodecParam.plname, "G729") == 0)
280 || (STR_CASE_CMP(myCodecParam.plname, "G723") == 0)
281 || (STR_CASE_CMP(myCodecParam.plname, "AMR") == 0)
282 || (STR_CASE_CMP(myCodecParam.plname, "AMR-wb") == 0)
283 || (STR_CASE_CMP(myCodecParam.plname, "speex") == 0)) {
284 _acmA->IsInternalDTXReplacedWithWebRtc(&isReplaced);
285 if (!isReplaced) {
286 dtxInUse = false;
niklase@google.com470e71d2011-07-07 08:21:25 +0000287 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000288 } else if (STR_CASE_CMP(myCodecParam.plname, "opus") == 0) {
289 if (_getStruct.statusDTX != false) {
290 // DTX status doesn't match expected.
291 vadPattern |= 4;
292 } else if (_getStruct.statusVAD != false) {
293 // Mismatch in VAD setting.
294 vadPattern |= 2;
295 } else {
296 _setStruct.statusDTX = false;
297 _setStruct.statusVAD = false;
298 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000299 }
phoglund@webrtc.orgd1a860b2012-01-26 14:49:28 +0000300
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000301 // Check for error in VAD/DTX settings
302 if (_getStruct.statusDTX != _setStruct.statusDTX) {
303 // DTX status doesn't match expected
304 vadPattern |= 4;
305 }
306 if (_getStruct.statusDTX) {
307 if ((!_getStruct.statusVAD && dtxInUse)
308 || (!dtxInUse && (_getStruct.statusVAD != _setStruct.statusVAD))) {
309 // Missmatch in VAD setting
310 vadPattern |= 2;
niklase@google.com470e71d2011-07-07 08:21:25 +0000311 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000312 } else {
313 if (_getStruct.statusVAD != _setStruct.statusVAD) {
314 // VAD status doesn't match expected
315 vadPattern |= 2;
316 }
317 }
318 if (_getStruct.vadMode != _setStruct.vadMode) {
319 // VAD Mode doesn't match expected
320 vadPattern |= 1;
321 }
322
323 // Set expected empty frame pattern
324 int ii;
325 for (ii = 0; ii < 6; ii++) {
326 emptyFramePattern[ii] = 0;
327 }
328 // 0 - "kNoEncoding", not important to check.
329 // Codecs with packetsize != 80 samples will get this output.
330 // 1 - "kActiveNormalEncoded", expect to receive some frames with this label .
331 // 2 - "kPassiveNormalEncoded".
332 // 3 - "kPassiveDTXNB".
333 // 4 - "kPassiveDTXWB".
334 // 5 - "kPassiveDTXSWB".
335 emptyFramePattern[0] = 1;
336 emptyFramePattern[1] = 1;
337 emptyFramePattern[2] = (((!_getStruct.statusDTX && _getStruct.statusVAD)
338 || (!dtxInUse && _getStruct.statusDTX)));
339 emptyFramePattern[3] = ((_getStruct.statusDTX && dtxInUse
340 && (_acmA->SendFrequency() == 8000)));
341 emptyFramePattern[4] = ((_getStruct.statusDTX && dtxInUse
342 && (_acmA->SendFrequency() == 16000)));
343 emptyFramePattern[5] = ((_getStruct.statusDTX && dtxInUse
344 && (_acmA->SendFrequency() == 32000)));
345
346 // Check pattern 1-5 (skip 0)
347 for (int ii = 1; ii < 6; ii++) {
348 if (emptyFramePattern[ii]) {
349 statusEF |= (_statCounter[ii] == 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000350 } else {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000351 statusEF |= (_statCounter[ii] > 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000352 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000353 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000354 EXPECT_EQ(0, statusEF);
355 EXPECT_EQ(0, vadPattern);
356
357 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000358}
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +0000359
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000360ActivityMonitor::ActivityMonitor() {
361 _counter[0] = _counter[1] = _counter[2] = _counter[3] = _counter[4] =
362 _counter[5] = 0;
363}
364
365ActivityMonitor::~ActivityMonitor() {
366}
367
368int32_t ActivityMonitor::InFrameType(int16_t frameType) {
369 _counter[frameType]++;
370 return 0;
371}
372
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000373void ActivityMonitor::PrintStatistics() {
374 printf("\n");
375 printf("kActiveNormalEncoded kPassiveNormalEncoded kPassiveDTXWB ");
376 printf("kPassiveDTXNB kPassiveDTXSWB kFrameEmpty\n");
377 printf("%19u", _counter[1]);
378 printf("%22u", _counter[2]);
379 printf("%14u", _counter[3]);
380 printf("%14u", _counter[4]);
381 printf("%14u", _counter[5]);
382 printf("%11u", _counter[0]);
383 printf("\n\n");
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000384}
385
386void ActivityMonitor::ResetStatistics() {
387 _counter[0] = _counter[1] = _counter[2] = _counter[3] = _counter[4] =
388 _counter[5] = 0;
389}
390
391void ActivityMonitor::GetStatistics(uint32_t* getCounter) {
392 for (int ii = 0; ii < 6; ii++) {
393 getCounter[ii] = _counter[ii];
394 }
395}
396
397} // namespace webrtc