blob: 1b74a956a8904cf182ce42c2551c1eefe50b8ffa [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org91b359e2012-02-28 17:26:14 +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
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +000011#include "TwoWayCommunication.h"
12
pbos@webrtc.org12dc1a32013-08-05 16:22:53 +000013#include <ctype.h>
niklase@google.com470e71d2011-07-07 08:21:25 +000014#include <stdio.h>
15#include <string.h>
16
17#ifdef WIN32
18#include <Windows.h>
19#endif
20
niklase@google.com470e71d2011-07-07 08:21:25 +000021#include "common_types.h"
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +000022#include "engine_configurations.h"
23#include "gtest/gtest.h"
24#include "PCMFile.h"
25#include "trace.h"
26#include "utility.h"
pbos@webrtc.org2ab209e2013-08-09 08:49:48 +000027#include "webrtc/test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000028
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000029namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000030
31#define MAX_FILE_NAME_LENGTH_BYTE 500
32
andrew@webrtc.org89df0922013-09-12 01:27:43 +000033TwoWayCommunication::TwoWayCommunication(int testMode)
34 : _acmA(AudioCodingModule::Create(1)),
35 _acmB(AudioCodingModule::Create(2)),
36 _acmRefA(AudioCodingModule::Create(3)),
37 _acmRefB(AudioCodingModule::Create(4)),
38 _testMode(testMode) {
niklase@google.com470e71d2011-07-07 08:21:25 +000039}
40
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000041TwoWayCommunication::~TwoWayCommunication() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000042 delete _channel_A2B;
43 delete _channel_B2A;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000044 delete _channelRef_A2B;
45 delete _channelRef_B2A;
niklase@google.com470e71d2011-07-07 08:21:25 +000046#ifdef WEBRTC_DTMF_DETECTION
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000047 if (_dtmfDetectorA != NULL) {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000048 delete _dtmfDetectorA;
49 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000050 if (_dtmfDetectorB != NULL) {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000051 delete _dtmfDetectorB;
52 }
niklase@google.com470e71d2011-07-07 08:21:25 +000053#endif
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000054 _inFileA.Close();
55 _inFileB.Close();
56 _outFileA.Close();
57 _outFileB.Close();
58 _outFileRefA.Close();
59 _outFileRefB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +000060}
61
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000062void TwoWayCommunication::ChooseCodec(uint8_t* codecID_A,
63 uint8_t* codecID_B) {
andrew@webrtc.org89df0922013-09-12 01:27:43 +000064 scoped_ptr<AudioCodingModule> tmpACM(AudioCodingModule::Create(0));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000065 uint8_t noCodec = tmpACM->NumberOfCodecs();
66 CodecInst codecInst;
67 printf("List of Supported Codecs\n");
68 printf("========================\n");
69 for (uint8_t codecCntr = 0; codecCntr < noCodec; codecCntr++) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000070 EXPECT_EQ(tmpACM->Codec(codecCntr, &codecInst), 0);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000071 printf("%d- %s\n", codecCntr, codecInst.plname);
72 }
73 printf("\nChoose a send codec for side A [0]: ");
74 char myStr[15] = "";
75 EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
76 *codecID_A = (uint8_t) atoi(myStr);
niklase@google.com470e71d2011-07-07 08:21:25 +000077
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000078 printf("\nChoose a send codec for side B [0]: ");
79 EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
80 *codecID_B = (uint8_t) atoi(myStr);
niklase@google.com470e71d2011-07-07 08:21:25 +000081
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000082 printf("\n");
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000083}
niklase@google.com470e71d2011-07-07 08:21:25 +000084
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000085void TwoWayCommunication::SetUp() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000086 uint8_t codecID_A;
87 uint8_t codecID_B;
88
89 ChooseCodec(&codecID_A, &codecID_B);
90 CodecInst codecInst_A;
91 CodecInst codecInst_B;
92 CodecInst dummyCodec;
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000093 EXPECT_EQ(0, _acmA->Codec(codecID_A, &codecInst_A));
94 EXPECT_EQ(0, _acmB->Codec(codecID_B, &codecInst_B));
95 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000096
97 //--- Set A codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000098 EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A));
99 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000100#ifdef WEBRTC_DTMF_DETECTION
101 _dtmfDetectorA = new(DTMFDetector);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000102 EXPECT_GT(_acmA->RegisterIncomingMessagesCallback(_dtmfDetectorA, ACMUSA),
103 -1);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000104#endif
105 //--- Set ref-A codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000106 EXPECT_EQ(0, _acmRefA->RegisterSendCodec(codecInst_A));
107 EXPECT_EQ(0, _acmRefA->RegisterReceiveCodec(codecInst_B));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000108
109 //--- Set B codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000110 EXPECT_EQ(0, _acmB->RegisterSendCodec(codecInst_B));
111 EXPECT_EQ(0, _acmB->RegisterReceiveCodec(codecInst_A));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000112#ifdef WEBRTC_DTMF_DETECTION
113 _dtmfDetectorB = new(DTMFDetector);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000114 EXPECT_GT(_acmB->RegisterIncomingMessagesCallback(_dtmfDetectorB, ACMUSA),
115 -1);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000116#endif
117
118 //--- Set ref-B codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000119 EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B));
120 EXPECT_EQ(0, _acmRefB->RegisterReceiveCodec(codecInst_A));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000121
122 uint16_t frequencyHz;
123
124 //--- Input A
125 std::string in_file_name = webrtc::test::ResourcePath(
126 "audio_coding/testfile32kHz", "pcm");
127 frequencyHz = 32000;
128 printf("Enter input file at side A [%s]: ", in_file_name.c_str());
129 PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz);
130 _inFileA.Open(in_file_name, frequencyHz, "rb");
131
132 //--- Output A
133 std::string out_file_a = webrtc::test::OutputPath() + "outA.pcm";
134 printf("Output file at side A: %s\n", out_file_a.c_str());
135 printf("Sampling frequency (in Hz) of the above file: %u\n", frequencyHz);
136 _outFileA.Open(out_file_a, frequencyHz, "wb");
137 std::string ref_file_name = webrtc::test::OutputPath() + "ref_outA.pcm";
138 _outFileRefA.Open(ref_file_name, frequencyHz, "wb");
139
140 //--- Input B
141 in_file_name = webrtc::test::ResourcePath("audio_coding/testfile32kHz",
142 "pcm");
143 frequencyHz = 32000;
144 printf("\n\nEnter input file at side B [%s]: ", in_file_name.c_str());
145 PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz);
146 _inFileB.Open(in_file_name, frequencyHz, "rb");
147
148 //--- Output B
149 std::string out_file_b = webrtc::test::OutputPath() + "outB.pcm";
150 printf("Output file at side B: %s\n", out_file_b.c_str());
151 printf("Sampling frequency (in Hz) of the above file: %u\n", frequencyHz);
152 _outFileB.Open(out_file_b, frequencyHz, "wb");
153 ref_file_name = webrtc::test::OutputPath() + "ref_outB.pcm";
154 _outFileRefB.Open(ref_file_name, frequencyHz, "wb");
155
156 //--- Set A-to-B channel
157 _channel_A2B = new Channel;
158 _acmA->RegisterTransportCallback(_channel_A2B);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000159 _channel_A2B->RegisterReceiverACM(_acmB.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000160 //--- Do the same for the reference
161 _channelRef_A2B = new Channel;
162 _acmRefA->RegisterTransportCallback(_channelRef_A2B);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000163 _channelRef_A2B->RegisterReceiverACM(_acmRefB.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000164
165 //--- Set B-to-A channel
166 _channel_B2A = new Channel;
167 _acmB->RegisterTransportCallback(_channel_B2A);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000168 _channel_B2A->RegisterReceiverACM(_acmA.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000169 //--- Do the same for reference
170 _channelRef_B2A = new Channel;
171 _acmRefB->RegisterTransportCallback(_channelRef_B2A);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000172 _channelRef_B2A->RegisterReceiverACM(_acmRefA.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000173
174 // The clicks will be more obvious when we
175 // are in FAX mode.
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000176 EXPECT_EQ(_acmB->SetPlayoutMode(fax), 0);
177 EXPECT_EQ(_acmRefB->SetPlayoutMode(fax), 0);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000178}
179
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000180void TwoWayCommunication::SetUpAutotest() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000181 CodecInst codecInst_A;
182 CodecInst codecInst_B;
183 CodecInst dummyCodec;
184
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000185 EXPECT_EQ(0, _acmA->Codec("ISAC", &codecInst_A, 16000, 1));
186 EXPECT_EQ(0, _acmB->Codec("L16", &codecInst_B, 8000, 1));
187 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000188
189 //--- Set A codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000190 EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A));
191 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000192#ifdef WEBRTC_DTMF_DETECTION
193 _dtmfDetectorA = new(DTMFDetector);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000194 EXPECT_EQ(0, _acmA->RegisterIncomingMessagesCallback(_dtmfDetectorA, ACMUSA));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000195#endif
196
197 //--- Set ref-A codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000198 EXPECT_GT(_acmRefA->RegisterSendCodec(codecInst_A), -1);
199 EXPECT_GT(_acmRefA->RegisterReceiveCodec(codecInst_B), -1);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000200
201 //--- Set B codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000202 EXPECT_GT(_acmB->RegisterSendCodec(codecInst_B), -1);
203 EXPECT_GT(_acmB->RegisterReceiveCodec(codecInst_A), -1);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000204#ifdef WEBRTC_DTMF_DETECTION
205 _dtmfDetectorB = new(DTMFDetector);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000206 EXPECT_EQ(0, _acmB->RegisterIncomingMessagesCallback(_dtmfDetectorB, ACMUSA));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000207#endif
208
209 //--- Set ref-B codecs
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000210 EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B));
211 EXPECT_EQ(0, _acmRefB->RegisterReceiveCodec(codecInst_A));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000212
213 uint16_t frequencyHz;
214
215 //--- Input A and B
216 std::string in_file_name = webrtc::test::ResourcePath(
217 "audio_coding/testfile32kHz", "pcm");
218 frequencyHz = 16000;
219 _inFileA.Open(in_file_name, frequencyHz, "rb");
220 _inFileB.Open(in_file_name, frequencyHz, "rb");
221
222 //--- Output A
223 std::string output_file_a = webrtc::test::OutputPath() + "outAutotestA.pcm";
224 frequencyHz = 16000;
225 _outFileA.Open(output_file_a, frequencyHz, "wb");
226 std::string output_ref_file_a = webrtc::test::OutputPath()
227 + "ref_outAutotestA.pcm";
228 _outFileRefA.Open(output_ref_file_a, frequencyHz, "wb");
229
230 //--- Output B
231 std::string output_file_b = webrtc::test::OutputPath() + "outAutotestB.pcm";
232 frequencyHz = 16000;
233 _outFileB.Open(output_file_b, frequencyHz, "wb");
234 std::string output_ref_file_b = webrtc::test::OutputPath()
235 + "ref_outAutotestB.pcm";
236 _outFileRefB.Open(output_ref_file_b, frequencyHz, "wb");
237
238 //--- Set A-to-B channel
239 _channel_A2B = new Channel;
240 _acmA->RegisterTransportCallback(_channel_A2B);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000241 _channel_A2B->RegisterReceiverACM(_acmB.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000242 //--- Do the same for the reference
243 _channelRef_A2B = new Channel;
244 _acmRefA->RegisterTransportCallback(_channelRef_A2B);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000245 _channelRef_A2B->RegisterReceiverACM(_acmRefB.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000246
247 //--- Set B-to-A channel
248 _channel_B2A = new Channel;
249 _acmB->RegisterTransportCallback(_channel_B2A);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000250 _channel_B2A->RegisterReceiverACM(_acmA.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000251 //--- Do the same for reference
252 _channelRef_B2A = new Channel;
253 _acmRefB->RegisterTransportCallback(_channelRef_B2A);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000254 _channelRef_B2A->RegisterReceiverACM(_acmRefA.get());
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000255
256 // The clicks will be more obvious when we
257 // are in FAX mode.
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000258 EXPECT_EQ(0, _acmB->SetPlayoutMode(fax));
259 EXPECT_EQ(0, _acmRefB->SetPlayoutMode(fax));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000260}
261
262void TwoWayCommunication::Perform() {
263 if (_testMode == 0) {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000264 SetUpAutotest();
265 } else {
266 SetUp();
267 }
268 unsigned int msecPassed = 0;
269 unsigned int secPassed = 0;
270
271 int32_t outFreqHzA = _outFileA.SamplingFrequency();
272 int32_t outFreqHzB = _outFileB.SamplingFrequency();
273
274 AudioFrame audioFrame;
275
276 CodecInst codecInst_B;
277 CodecInst dummy;
278
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000279 EXPECT_EQ(0, _acmB->SendCodec(&codecInst_B));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000280
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000281 // In the following loop we tests that the code can handle misuse of the APIs.
282 // In the middle of a session with data flowing between two sides, called A
283 // and B, APIs will be called, like ResetEncoder(), and the code should
284 // continue to run, and be able to recover.
285 bool expect_error_add = false;
286 bool expect_error_process = false;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000287 while (!_inFileA.EndOfFile() && !_inFileB.EndOfFile()) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000288 msecPassed += 10;
289 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0);
290 EXPECT_EQ(0, _acmA->Add10MsData(audioFrame));
291 EXPECT_EQ(0, _acmRefA->Add10MsData(audioFrame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000292
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000293 EXPECT_GT(_inFileB.Read10MsData(audioFrame), 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000294
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000295 // Expect call to pass except for the time when no send codec is registered.
296 if (!expect_error_add) {
297 EXPECT_EQ(0, _acmB->Add10MsData(audioFrame));
298 } else {
299 EXPECT_EQ(-1, _acmB->Add10MsData(audioFrame));
300 }
301 // Expect to pass except for the time when there either is no send codec
302 // registered, or no receive codec.
303 if (!expect_error_process) {
304 EXPECT_GT(_acmB->Process(), -1);
305 } else {
306 EXPECT_EQ(_acmB->Process(), -1);
307 }
308 EXPECT_EQ(0, _acmRefB->Add10MsData(audioFrame));
309 EXPECT_GT(_acmA->Process(), -1);
310 EXPECT_GT(_acmRefA->Process(), -1);
311 EXPECT_GT(_acmRefB->Process(), -1);
312 EXPECT_EQ(0, _acmA->PlayoutData10Ms(outFreqHzA, &audioFrame));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000313 _outFileA.Write10MsData(audioFrame);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000314 EXPECT_EQ(0, _acmRefA->PlayoutData10Ms(outFreqHzA, &audioFrame));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000315 _outFileRefA.Write10MsData(audioFrame);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000316 EXPECT_EQ(0, _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000317 _outFileB.Write10MsData(audioFrame);
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000318 EXPECT_EQ(0, _acmRefB->PlayoutData10Ms(outFreqHzB, &audioFrame));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000319 _outFileRefB.Write10MsData(audioFrame);
niklase@google.com470e71d2011-07-07 08:21:25 +0000320
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000321 // Update time counters each time a second of data has passed.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000322 if (msecPassed >= 1000) {
323 msecPassed = 0;
324 secPassed++;
325 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000326 // Call RestEncoder for ACM on side A, and InitializeSender for ACM on
327 // side B.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000328 if (((secPassed % 5) == 4) && (msecPassed == 0)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000329 EXPECT_EQ(0, _acmA->ResetEncoder());
330 EXPECT_EQ(0, _acmB->InitializeSender());
331 expect_error_add = true;
332 expect_error_process = true;
niklase@google.com470e71d2011-07-07 08:21:25 +0000333 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000334 // Re-register send codec on side B.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000335 if (((secPassed % 5) == 4) && (msecPassed >= 990)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000336 EXPECT_EQ(0, _acmB->RegisterSendCodec(codecInst_B));
337 EXPECT_EQ(0, _acmB->SendCodec(&dummy));
338 expect_error_add = false;
339 expect_error_process = false;
niklase@google.com470e71d2011-07-07 08:21:25 +0000340 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000341 // Reset decoder on side B, and initialize receiver on side A.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000342 if (((secPassed % 7) == 6) && (msecPassed == 0)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000343 EXPECT_EQ(0, _acmB->ResetDecoder());
344 EXPECT_EQ(0, _acmA->InitializeReceiver());
niklase@google.com470e71d2011-07-07 08:21:25 +0000345 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000346 // Re-register codec on side A.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000347 if (((secPassed % 7) == 6) && (msecPassed >= 990)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000348 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B));
niklase@google.com470e71d2011-07-07 08:21:25 +0000349 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000350 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000351}
352
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000353} // namespace webrtc