blob: 531fe96c9faf4eac5470b26f8cb7bcb7de95b906 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.org9dc45da2012-05-23 15:39:01 +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
kjellander3e6db232015-11-26 04:44:54 -080011#include "webrtc/modules/audio_coding/test/iSACTest.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000012
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
kwiberg77eab702016-09-28 17:42:01 -070017#ifdef _WIN32
niklase@google.com470e71d2011-07-07 08:21:25 +000018#include <windows.h>
kwiberg77eab702016-09-28 17:42:01 -070019#elif defined(WEBRTC_LINUX)
pbos@webrtc.org12dc1a32013-08-05 16:22:53 +000020#include <time.h>
niklase@google.com470e71d2011-07-07 08:21:25 +000021#else
22#include <sys/time.h>
23#include <time.h>
andrew@webrtc.org89df0922013-09-12 01:27:43 +000024#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000025
kwibergda2bf4e2016-10-24 13:47:09 -070026#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
kjellander3e6db232015-11-26 04:44:54 -080027#include "webrtc/modules/audio_coding/test/utility.h"
Henrik Kjellander98f53512015-10-28 18:17:40 +010028#include "webrtc/system_wrappers/include/event_wrapper.h"
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000029#include "webrtc/test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000030
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000031namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000032
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000033void SetISACConfigDefault(ACMTestISACConfig& isacConfig) {
34 isacConfig.currentRateBitPerSec = 0;
35 isacConfig.currentFrameSizeMsec = 0;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000036 isacConfig.encodingMode = -1;
37 isacConfig.initRateBitPerSec = 0;
38 isacConfig.initFrameSizeInMsec = 0;
39 isacConfig.enforceFrameSize = false;
40 return;
niklase@google.com470e71d2011-07-07 08:21:25 +000041}
42
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000043int16_t SetISAConfig(ACMTestISACConfig& isacConfig, AudioCodingModule* acm,
44 int testMode) {
niklase@google.com470e71d2011-07-07 08:21:25 +000045
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000046 if ((isacConfig.currentRateBitPerSec != 0)
47 || (isacConfig.currentFrameSizeMsec != 0)) {
kwiberg1fd4a4a2015-11-03 11:20:50 -080048 auto sendCodec = acm->SendCodec();
49 EXPECT_TRUE(sendCodec);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000050 if (isacConfig.currentRateBitPerSec < 0) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000051 // Register iSAC in adaptive (channel-dependent) mode.
kwiberg1fd4a4a2015-11-03 11:20:50 -080052 sendCodec->rate = -1;
53 EXPECT_EQ(0, acm->RegisterSendCodec(*sendCodec));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000054 } else {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000055 if (isacConfig.currentRateBitPerSec != 0) {
kwiberg1fd4a4a2015-11-03 11:20:50 -080056 sendCodec->rate = isacConfig.currentRateBitPerSec;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000057 }
58 if (isacConfig.currentFrameSizeMsec != 0) {
kwiberg1fd4a4a2015-11-03 11:20:50 -080059 sendCodec->pacsize = isacConfig.currentFrameSizeMsec
60 * (sendCodec->plfreq / 1000);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000061 }
kwiberg1fd4a4a2015-11-03 11:20:50 -080062 EXPECT_EQ(0, acm->RegisterSendCodec(*sendCodec));
niklase@google.com470e71d2011-07-07 08:21:25 +000063 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000064 }
niklase@google.com470e71d2011-07-07 08:21:25 +000065
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000066 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000067}
68
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000069ISACTest::ISACTest(int testMode)
70 : _acmA(AudioCodingModule::Create(1)),
71 _acmB(AudioCodingModule::Create(2)),
72 _testMode(testMode) {}
niklase@google.com470e71d2011-07-07 08:21:25 +000073
turaj@webrtc.org55e17232013-10-29 04:40:09 +000074ISACTest::~ISACTest() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000075
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000076void ISACTest::Setup() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000077 int codecCntr;
78 CodecInst codecParam;
niklase@google.com470e71d2011-07-07 08:21:25 +000079
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000080 for (codecCntr = 0; codecCntr < AudioCodingModule::NumberOfCodecs();
81 codecCntr++) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000082 EXPECT_EQ(0, AudioCodingModule::Codec(codecCntr, &codecParam));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000083 if (!STR_CASE_CMP(codecParam.plname, "ISAC")
84 && codecParam.plfreq == 16000) {
85 memcpy(&_paramISAC16kHz, &codecParam, sizeof(CodecInst));
86 _idISAC16kHz = codecCntr;
niklase@google.com470e71d2011-07-07 08:21:25 +000087 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000088 if (!STR_CASE_CMP(codecParam.plname, "ISAC")
89 && codecParam.plfreq == 32000) {
90 memcpy(&_paramISAC32kHz, &codecParam, sizeof(CodecInst));
91 _idISAC32kHz = codecCntr;
niklase@google.com470e71d2011-07-07 08:21:25 +000092 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000093 }
niklase@google.com470e71d2011-07-07 08:21:25 +000094
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000095 // Register both iSAC-wb & iSAC-swb in both sides as receiver codecs.
kwibergda2bf4e2016-10-24 13:47:09 -070096 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(_paramISAC16kHz.pltype,
97 CodecInstToSdp(_paramISAC16kHz)));
98 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(_paramISAC32kHz.pltype,
99 CodecInstToSdp(_paramISAC32kHz)));
100 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(_paramISAC16kHz.pltype,
101 CodecInstToSdp(_paramISAC16kHz)));
102 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(_paramISAC32kHz.pltype,
103 CodecInstToSdp(_paramISAC32kHz)));
niklase@google.com470e71d2011-07-07 08:21:25 +0000104
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000105 //--- Set A-to-B channel
turaj@webrtc.org55e17232013-10-29 04:40:09 +0000106 _channel_A2B.reset(new Channel);
107 EXPECT_EQ(0, _acmA->RegisterTransportCallback(_channel_A2B.get()));
108 _channel_A2B->RegisterReceiverACM(_acmB.get());
niklase@google.com470e71d2011-07-07 08:21:25 +0000109
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000110 //--- Set B-to-A channel
turaj@webrtc.org55e17232013-10-29 04:40:09 +0000111 _channel_B2A.reset(new Channel);
112 EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A.get()));
113 _channel_B2A->RegisterReceiverACM(_acmA.get());
niklase@google.com470e71d2011-07-07 08:21:25 +0000114
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000115 file_name_swb_ = webrtc::test::ResourcePath("audio_coding/testfile32kHz",
116 "pcm");
niklase@google.com470e71d2011-07-07 08:21:25 +0000117
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000118 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz));
119 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC32kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000120
121 _inFileA.Open(file_name_swb_, 32000, "rb");
Henrik Lundin4d682082015-12-10 16:24:39 +0100122 // Set test length to 500 ms (50 blocks of 10 ms each).
123 _inFileA.SetNum10MsBlocksToRead(50);
124 // Fast-forward 1 second (100 blocks) since the files start with silence.
125 _inFileA.FastForward(100);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000126 std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm";
127 std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm";
128 _outFileA.Open(fileNameA, 32000, "wb");
129 _outFileB.Open(fileNameB, 32000, "wb");
130
131 while (!_inFileA.EndOfFile()) {
132 Run10ms();
133 }
134 CodecInst receiveCodec;
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000135 EXPECT_EQ(0, _acmA->ReceiveCodec(&receiveCodec));
136 EXPECT_EQ(0, _acmB->ReceiveCodec(&receiveCodec));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000137
138 _inFileA.Close();
139 _outFileA.Close();
140 _outFileB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000141}
142
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000143void ISACTest::Perform() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000144 Setup();
niklase@google.com470e71d2011-07-07 08:21:25 +0000145
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000146 int16_t testNr = 0;
147 ACMTestISACConfig wbISACConfig;
148 ACMTestISACConfig swbISACConfig;
niklase@google.com470e71d2011-07-07 08:21:25 +0000149
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000150 SetISACConfigDefault(wbISACConfig);
151 SetISACConfigDefault(swbISACConfig);
niklase@google.com470e71d2011-07-07 08:21:25 +0000152
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000153 wbISACConfig.currentRateBitPerSec = -1;
154 swbISACConfig.currentRateBitPerSec = -1;
155 testNr++;
156 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
157
158 if (_testMode != 0) {
niklase@google.com470e71d2011-07-07 08:21:25 +0000159 SetISACConfigDefault(wbISACConfig);
160 SetISACConfigDefault(swbISACConfig);
161
162 wbISACConfig.currentRateBitPerSec = -1;
163 swbISACConfig.currentRateBitPerSec = -1;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000164 wbISACConfig.initRateBitPerSec = 13000;
165 wbISACConfig.initFrameSizeInMsec = 60;
166 swbISACConfig.initRateBitPerSec = 20000;
167 swbISACConfig.initFrameSizeInMsec = 30;
niklase@google.com470e71d2011-07-07 08:21:25 +0000168 testNr++;
169 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
170
niklase@google.com470e71d2011-07-07 08:21:25 +0000171 SetISACConfigDefault(wbISACConfig);
172 SetISACConfigDefault(swbISACConfig);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000173
174 wbISACConfig.currentRateBitPerSec = 20000;
175 swbISACConfig.currentRateBitPerSec = 48000;
niklase@google.com470e71d2011-07-07 08:21:25 +0000176 testNr++;
177 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
pbos@webrtc.org0946a562013-04-09 00:28:06 +0000178
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000179 wbISACConfig.currentRateBitPerSec = 16000;
180 swbISACConfig.currentRateBitPerSec = 30000;
181 wbISACConfig.currentFrameSizeMsec = 60;
niklase@google.com470e71d2011-07-07 08:21:25 +0000182 testNr++;
183 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000184 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000185
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000186 SetISACConfigDefault(wbISACConfig);
187 SetISACConfigDefault(swbISACConfig);
188 testNr++;
189 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
niklase@google.com470e71d2011-07-07 08:21:25 +0000190
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000191 testNr++;
192 if (_testMode == 0) {
193 SwitchingSamplingRate(testNr, 4);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000194 } else {
195 SwitchingSamplingRate(testNr, 80);
196 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000197}
198
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +0000199void ISACTest::Run10ms() {
200 AudioFrame audioFrame;
201 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0);
henrik.lundin@webrtc.orgf56c1622015-03-02 12:29:30 +0000202 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0);
203 EXPECT_GE(_acmB->Add10MsData(audioFrame), 0);
henrik.lundind4ccb002016-05-17 12:21:55 -0700204 bool muted;
205 EXPECT_EQ(0, _acmA->PlayoutData10Ms(32000, &audioFrame, &muted));
206 ASSERT_FALSE(muted);
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +0000207 _outFileA.Write10MsData(audioFrame);
henrik.lundind4ccb002016-05-17 12:21:55 -0700208 EXPECT_EQ(0, _acmB->PlayoutData10Ms(32000, &audioFrame, &muted));
209 ASSERT_FALSE(muted);
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +0000210 _outFileB.Write10MsData(audioFrame);
211}
212
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000213void ISACTest::EncodeDecode(int testNr, ACMTestISACConfig& wbISACConfig,
214 ACMTestISACConfig& swbISACConfig) {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000215 // Files in Side A and B
216 _inFileA.Open(file_name_swb_, 32000, "rb", true);
217 _inFileB.Open(file_name_swb_, 32000, "rb", true);
218
219 std::string file_name_out;
220 std::stringstream file_stream_a;
221 std::stringstream file_stream_b;
222 file_stream_a << webrtc::test::OutputPath();
223 file_stream_b << webrtc::test::OutputPath();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000224 file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
225 file_stream_b << "out_iSACTest_B_" << testNr << ".pcm";
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000226 file_name_out = file_stream_a.str();
227 _outFileA.Open(file_name_out, 32000, "wb");
228 file_name_out = file_stream_b.str();
229 _outFileB.Open(file_name_out, 32000, "wb");
230
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000231 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC16kHz));
232 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC32kHz));
233 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC32kHz));
234 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000235
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000236 // Side A is sending super-wideband, and side B is sending wideband.
turaj@webrtc.org55e17232013-10-29 04:40:09 +0000237 SetISAConfig(swbISACConfig, _acmA.get(), _testMode);
238 SetISAConfig(wbISACConfig, _acmB.get(), _testMode);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000239
240 bool adaptiveMode = false;
241 if ((swbISACConfig.currentRateBitPerSec == -1)
242 || (wbISACConfig.currentRateBitPerSec == -1)) {
243 adaptiveMode = true;
244 }
245 _myTimer.Reset();
246 _channel_A2B->ResetStats();
247 _channel_B2A->ResetStats();
248
249 char currentTime[500];
Peter Boström64c03662015-04-08 11:24:19 +0200250 EventTimerWrapper* myEvent = EventTimerWrapper::Create();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000251 EXPECT_TRUE(myEvent->StartTimer(true, 10));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000252 while (!(_inFileA.EndOfFile() || _inFileA.Rewinded())) {
253 Run10ms();
254 _myTimer.Tick10ms();
255 _myTimer.CurrentTimeHMS(currentTime);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000256
257 if ((adaptiveMode) && (_testMode != 0)) {
258 myEvent->Wait(5000);
kwiberg1fd4a4a2015-11-03 11:20:50 -0800259 EXPECT_TRUE(_acmA->SendCodec());
260 EXPECT_TRUE(_acmB->SendCodec());
niklase@google.com470e71d2011-07-07 08:21:25 +0000261 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000262 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000263
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000264 if (_testMode != 0) {
265 printf("\n\nSide A statistics\n\n");
266 _channel_A2B->PrintStats(_paramISAC32kHz);
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000267
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000268 printf("\n\nSide B statistics\n\n");
269 _channel_B2A->PrintStats(_paramISAC16kHz);
270 }
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000271
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +0000272 _channel_A2B->ResetStats();
273 _channel_B2A->ResetStats();
274
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000275 _outFileA.Close();
276 _outFileB.Close();
277 _inFileA.Close();
278 _inFileB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000279}
280
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000281void ISACTest::SwitchingSamplingRate(int testNr, int maxSampRateChange) {
282 // Files in Side A
283 _inFileA.Open(file_name_swb_, 32000, "rb");
284 _inFileB.Open(file_name_swb_, 32000, "rb");
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000285
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000286 std::string file_name_out;
287 std::stringstream file_stream_a;
288 std::stringstream file_stream_b;
289 file_stream_a << webrtc::test::OutputPath();
290 file_stream_b << webrtc::test::OutputPath();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000291 file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
292 file_stream_b << "out_iSACTest_B_" << testNr << ".pcm";
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000293 file_name_out = file_stream_a.str();
294 _outFileA.Open(file_name_out, 32000, "wb");
295 file_name_out = file_stream_b.str();
296 _outFileB.Open(file_name_out, 32000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000297
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000298 // Start with side A sending super-wideband and side B seding wideband.
299 // Toggle sending wideband/super-wideband in this test.
300 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC32kHz));
301 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000302
303 int numSendCodecChanged = 0;
304 _myTimer.Reset();
305 char currentTime[50];
306 while (numSendCodecChanged < (maxSampRateChange << 1)) {
307 Run10ms();
308 _myTimer.Tick10ms();
309 _myTimer.CurrentTimeHMS(currentTime);
310 if (_testMode == 2)
311 printf("\r%s", currentTime);
312 if (_inFileA.EndOfFile()) {
313 if (_inFileA.SamplingFrequency() == 16000) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000314 // Switch side A to send super-wideband.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000315 _inFileA.Close();
316 _inFileA.Open(file_name_swb_, 32000, "rb");
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000317 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC32kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000318 } else {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000319 // Switch side A to send wideband.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000320 _inFileA.Close();
321 _inFileA.Open(file_name_swb_, 32000, "rb");
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000322 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC16kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000323 }
324 numSendCodecChanged++;
niklase@google.com470e71d2011-07-07 08:21:25 +0000325 }
326
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000327 if (_inFileB.EndOfFile()) {
328 if (_inFileB.SamplingFrequency() == 16000) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000329 // Switch side B to send super-wideband.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000330 _inFileB.Close();
331 _inFileB.Open(file_name_swb_, 32000, "rb");
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000332 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC32kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000333 } else {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000334 // Switch side B to send wideband.
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000335 _inFileB.Close();
336 _inFileB.Open(file_name_swb_, 32000, "rb");
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000337 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz));
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000338 }
339 numSendCodecChanged++;
niklase@google.com470e71d2011-07-07 08:21:25 +0000340 }
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000341 }
342 _outFileA.Close();
343 _outFileB.Close();
344 _inFileA.Close();
345 _inFileB.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000346}
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +0000347
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000348} // namespace webrtc