blob: a40f2b72ddf5aa25b7e1c9091717df4bc12d6743 [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
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000011#include "webrtc/modules/audio_coding/main/test/iSACTest.h"
12
niklase@google.com470e71d2011-07-07 08:21:25 +000013#include <cctype>
14#include <stdio.h>
15#include <string.h>
16
17#if _WIN32
18#include <windows.h>
19#elif WEBRTC_LINUX
20#include <ctime>
21#else
22#include <sys/time.h>
23#include <time.h>
24#endif
25
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000026#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
27#include "webrtc/modules/audio_coding/main/test/utility.h"
28#include "webrtc/system_wrappers/interface/event_wrapper.h"
29#include "webrtc/system_wrappers/interface/tick_util.h"
30#include "webrtc/system_wrappers/interface/trace.h"
31#include "webrtc/test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000032
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000033namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000034
35void SetISACConfigDefault(
36 ACMTestISACConfig& isacConfig)
37{
38 isacConfig.currentRateBitPerSec = 0;
39 isacConfig.currentFrameSizeMsec = 0;
40 isacConfig.maxRateBitPerSec = 0;
41 isacConfig.maxPayloadSizeByte = 0;
42 isacConfig.encodingMode = -1;
43 isacConfig.initRateBitPerSec = 0;
44 isacConfig.initFrameSizeInMsec = 0;
45 isacConfig.enforceFrameSize = false;
46 return;
47}
48
49
50WebRtc_Word16 SetISAConfig(
51 ACMTestISACConfig& isacConfig,
52 AudioCodingModule* acm,
53 int testMode)
54{
55
56 if((isacConfig.currentRateBitPerSec != 0) ||
57 (isacConfig.currentFrameSizeMsec != 0))
58 {
59 CodecInst sendCodec;
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +000060 acm->SendCodec(&sendCodec);
niklase@google.com470e71d2011-07-07 08:21:25 +000061 if(isacConfig.currentRateBitPerSec < 0)
62 {
63 sendCodec.rate = -1;
64 CHECK_ERROR(acm->RegisterSendCodec(sendCodec));
65 if(testMode != 0)
66 {
67 printf("ISAC-%s Registered in adaptive (channel-dependent) mode.\n",
68 (sendCodec.plfreq == 32000)? "swb":"wb");
69 }
70 }
71 else
72 {
73
74 if(isacConfig.currentRateBitPerSec != 0)
75 {
76 sendCodec.rate = isacConfig.currentRateBitPerSec;
77 }
78 if(isacConfig.currentFrameSizeMsec != 0)
79 {
80 sendCodec.pacsize = isacConfig.currentFrameSizeMsec *
81 (sendCodec.plfreq / 1000);
82 }
83 CHECK_ERROR(acm->RegisterSendCodec(sendCodec));
84 if(testMode != 0)
85 {
86 printf("Target rate is set to %d bit/sec with frame-size %d ms \n",
87 (int)isacConfig.currentRateBitPerSec,
88 (int)sendCodec.pacsize / (sendCodec.plfreq / 1000));
89 }
90 }
91 }
92
93 if(isacConfig.maxRateBitPerSec > 0)
94 {
95 CHECK_ERROR(acm->SetISACMaxRate(isacConfig.maxRateBitPerSec));
96 if(testMode != 0)
97 {
98 printf("Max rate is set to %u bit/sec\n",
99 isacConfig.maxRateBitPerSec);
100 }
101 }
102 if(isacConfig.maxPayloadSizeByte > 0)
103 {
104 CHECK_ERROR(acm->SetISACMaxPayloadSize(isacConfig.maxPayloadSizeByte));
105 if(testMode != 0)
106 {
107 printf("Max payload-size is set to %u bit/sec\n",
108 isacConfig.maxPayloadSizeByte);
109 }
110 }
111 if((isacConfig.initFrameSizeInMsec != 0) ||
112 (isacConfig.initRateBitPerSec != 0))
113 {
114 CHECK_ERROR(acm->ConfigISACBandwidthEstimator(
115 (WebRtc_UWord8)isacConfig.initFrameSizeInMsec,
116 (WebRtc_UWord16)isacConfig.initRateBitPerSec,
117 isacConfig.enforceFrameSize));
118 if((isacConfig.initFrameSizeInMsec != 0) && (testMode != 0))
119 {
120 printf("Initialize BWE to %d msec frame-size\n",
121 isacConfig.initFrameSizeInMsec);
122 }
123 if((isacConfig.initRateBitPerSec != 0) && (testMode != 0))
124 {
125 printf("Initialize BWE to %u bit/sec send-bandwidth\n",
126 isacConfig.initRateBitPerSec);
127 }
128 }
129
130 return 0;
131}
132
133
134ISACTest::ISACTest(int testMode)
135{
136 _testMode = testMode;
137}
138
139ISACTest::~ISACTest()
140{
141 AudioCodingModule::Destroy(_acmA);
142 AudioCodingModule::Destroy(_acmB);
143
144 delete _channel_A2B;
145 delete _channel_B2A;
146}
147
148
149WebRtc_Word16
150ISACTest::Setup()
151{
152 int codecCntr;
153 CodecInst codecParam;
154
155 _acmA = AudioCodingModule::Create(1);
156 _acmB = AudioCodingModule::Create(2);
157
158 for(codecCntr = 0; codecCntr < AudioCodingModule::NumberOfCodecs(); codecCntr++)
159 {
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000160 AudioCodingModule::Codec(codecCntr, &codecParam);
niklase@google.com470e71d2011-07-07 08:21:25 +0000161 if(!STR_CASE_CMP(codecParam.plname, "ISAC") && codecParam.plfreq == 16000)
162 {
163 memcpy(&_paramISAC16kHz, &codecParam, sizeof(CodecInst));
164 _idISAC16kHz = codecCntr;
165 }
166 if(!STR_CASE_CMP(codecParam.plname, "ISAC") && codecParam.plfreq == 32000)
167 {
168 memcpy(&_paramISAC32kHz, &codecParam, sizeof(CodecInst));
169 _idISAC32kHz = codecCntr;
170 }
171 }
172
173 // register both iSAC-wb & iSAC-swb in both sides as receiver codecs
174 CHECK_ERROR(_acmA->RegisterReceiveCodec(_paramISAC16kHz));
175 CHECK_ERROR(_acmA->RegisterReceiveCodec(_paramISAC32kHz));
176 CHECK_ERROR(_acmB->RegisterReceiveCodec(_paramISAC16kHz));
177 CHECK_ERROR(_acmB->RegisterReceiveCodec(_paramISAC32kHz));
178
179 //--- Set A-to-B channel
180 _channel_A2B = new Channel;
181 CHECK_ERROR(_acmA->RegisterTransportCallback(_channel_A2B));
182 _channel_A2B->RegisterReceiverACM(_acmB);
183
184 //--- Set B-to-A channel
185 _channel_B2A = new Channel;
186 CHECK_ERROR(_acmB->RegisterTransportCallback(_channel_B2A));
187 _channel_B2A->RegisterReceiverACM(_acmA);
188
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000189 file_name_swb_ =
190 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
niklase@google.com470e71d2011-07-07 08:21:25 +0000191
192 _acmB->RegisterSendCodec(_paramISAC16kHz);
193 _acmA->RegisterSendCodec(_paramISAC32kHz);
194
195 if(_testMode != 0)
196 {
197 printf("Side A Send Codec\n");
198 printf("%s %d\n", _paramISAC32kHz.plname, _paramISAC32kHz.plfreq);
199
200 printf("Side B Send Codec\n");
201 printf("%s %d\n", _paramISAC16kHz.plname, _paramISAC16kHz.plfreq);
202 }
203
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000204 _inFileA.Open(file_name_swb_, 32000, "rb");
kjellander@webrtc.org5490c712011-12-21 13:34:18 +0000205 std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm";
206 std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm";
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000207 _outFileA.Open(fileNameA, 32000, "wb");
208 _outFileB.Open(fileNameB, 32000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000209
210 while(!_inFileA.EndOfFile())
211 {
212 Run10ms();
213 }
214 CodecInst receiveCodec;
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000215 CHECK_ERROR(_acmA->ReceiveCodec(&receiveCodec));
niklase@google.com470e71d2011-07-07 08:21:25 +0000216 if(_testMode != 0)
217 {
218 printf("Side A Receive Codec\n");
219 printf("%s %d\n", receiveCodec.plname, receiveCodec.plfreq);
220 }
221
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000222 CHECK_ERROR(_acmB->ReceiveCodec(&receiveCodec));
niklase@google.com470e71d2011-07-07 08:21:25 +0000223 if(_testMode != 0)
224 {
225 printf("Side B Receive Codec\n");
226 printf("%s %d\n", receiveCodec.plname, receiveCodec.plfreq);
227 }
228
229 _inFileA.Close();
230 _outFileA.Close();
231 _outFileB.Close();
232
233 return 0;
234}
235
236
237void
238ISACTest::Perform()
239{
240 if(_testMode == 0)
241 {
242 printf("Running iSAC Test");
243 WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceAudioCoding, -1, "---------- iSACTest ----------");
244 }
245
246 Setup();
247
248 WebRtc_Word16 testNr = 0;
249 ACMTestISACConfig wbISACConfig;
250 ACMTestISACConfig swbISACConfig;
251
252 SetISACConfigDefault(wbISACConfig);
253 SetISACConfigDefault(swbISACConfig);
254
255 wbISACConfig.currentRateBitPerSec = -1;
256 swbISACConfig.currentRateBitPerSec = -1;
257 testNr++;
258 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
259
260 if (_testMode != 0)
261 {
262 SetISACConfigDefault(wbISACConfig);
263 SetISACConfigDefault(swbISACConfig);
264
265 wbISACConfig.currentRateBitPerSec = -1;
266 swbISACConfig.currentRateBitPerSec = -1;
267 wbISACConfig.initRateBitPerSec = 13000;
268 wbISACConfig.initFrameSizeInMsec = 60;
269 swbISACConfig.initRateBitPerSec = 20000;
270 swbISACConfig.initFrameSizeInMsec = 30;
271 testNr++;
272 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
273
274 SetISACConfigDefault(wbISACConfig);
275 SetISACConfigDefault(swbISACConfig);
276
277 wbISACConfig.currentRateBitPerSec = 20000;
278 swbISACConfig.currentRateBitPerSec = 48000;
279 testNr++;
280 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
281
282 wbISACConfig.currentRateBitPerSec = 16000;
283 swbISACConfig.currentRateBitPerSec = 30000;
284 wbISACConfig.currentFrameSizeMsec = 60;
285 testNr++;
286 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
287 }
288
289 SetISACConfigDefault(wbISACConfig);
290 SetISACConfigDefault(swbISACConfig);
291 testNr++;
292 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
293
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +0000294 int user_input;
niklase@google.com470e71d2011-07-07 08:21:25 +0000295 if((_testMode == 0) || (_testMode == 1))
296 {
297 swbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)200;
298 wbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)200;
299 }
300 else
301 {
302 printf("Enter the max payload-size for side A: ");
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +0000303 CHECK_ERROR(scanf("%d", &user_input));
304 swbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)user_input;
niklase@google.com470e71d2011-07-07 08:21:25 +0000305 printf("Enter the max payload-size for side B: ");
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +0000306 CHECK_ERROR(scanf("%d", &user_input));
307 wbISACConfig.maxPayloadSizeByte = (WebRtc_UWord16)user_input;
niklase@google.com470e71d2011-07-07 08:21:25 +0000308 }
309 testNr++;
310 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
311
312 _acmA->ResetEncoder();
313 _acmB->ResetEncoder();
314 SetISACConfigDefault(wbISACConfig);
315 SetISACConfigDefault(swbISACConfig);
316
317 if((_testMode == 0) || (_testMode == 1))
318 {
319 swbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)48000;
320 wbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)48000;
321 }
322 else
323 {
324 printf("Enter the max rate for side A: ");
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +0000325 CHECK_ERROR(scanf("%d", &user_input));
326 swbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)user_input;
niklase@google.com470e71d2011-07-07 08:21:25 +0000327 printf("Enter the max rate for side B: ");
kjellander@webrtc.org543c3ea2011-11-23 12:20:35 +0000328 CHECK_ERROR(scanf("%d", &user_input));
329 wbISACConfig.maxRateBitPerSec = (WebRtc_UWord32)user_input;
niklase@google.com470e71d2011-07-07 08:21:25 +0000330 }
331
332 testNr++;
333 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
334
335
336 testNr++;
337 if(_testMode == 0)
338 {
339 SwitchingSamplingRate(testNr, 4);
340 printf("Done!\n");
341 }
342 else
343 {
344 SwitchingSamplingRate(testNr, 80);
345 }
346}
347
348
349void
350ISACTest::Run10ms()
351{
352 AudioFrame audioFrame;
353
354 _inFileA.Read10MsData(audioFrame);
355 CHECK_ERROR(_acmA->Add10MsData(audioFrame));
356
357 CHECK_ERROR(_acmB->Add10MsData(audioFrame));
358
359 CHECK_ERROR(_acmA->Process());
360 CHECK_ERROR(_acmB->Process());
361
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000362 CHECK_ERROR(_acmA->PlayoutData10Ms(32000, &audioFrame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000363 _outFileA.Write10MsData(audioFrame);
364
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000365 CHECK_ERROR(_acmB->PlayoutData10Ms(32000, &audioFrame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000366 _outFileB.Write10MsData(audioFrame);
367}
368
369void
370ISACTest::EncodeDecode(
371 int testNr,
372 ACMTestISACConfig& wbISACConfig,
373 ACMTestISACConfig& swbISACConfig)
374{
375 if(_testMode == 0)
376 {
377 printf(".");
378 }
379 else
380 {
381 printf("\nTest %d:\n\n", testNr);
382 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000383
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000384 // Files in Side A and B
385 _inFileA.Open(file_name_swb_, 32000, "rb", true);
386 _inFileB.Open(file_name_swb_, 32000, "rb", true);
387
388 std::string file_name_out;
389 std::stringstream file_stream_a;
390 std::stringstream file_stream_b;
391 file_stream_a << webrtc::test::OutputPath();
392 file_stream_b << webrtc::test::OutputPath();
niklase@google.com470e71d2011-07-07 08:21:25 +0000393 if(_testMode == 0)
394 {
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000395 file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
396 file_stream_b << "out_iSACTest_B_" << testNr << ".pcm";
397
niklase@google.com470e71d2011-07-07 08:21:25 +0000398 }
399 else
400 {
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000401 file_stream_a << "outA_" << testNr << ".pcm";
402 file_stream_b << "outB_" << testNr << ".pcm";
niklase@google.com470e71d2011-07-07 08:21:25 +0000403 }
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000404 file_name_out = file_stream_a.str();
405 _outFileA.Open(file_name_out, 32000, "wb");
406 file_name_out = file_stream_b.str();
407 _outFileB.Open(file_name_out, 32000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000408
niklase@google.com470e71d2011-07-07 08:21:25 +0000409 CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC16kHz));
410 CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
411
412 CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC32kHz));
413 CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
414 if(_testMode != 0)
415 {
416 printf("Side A Sending Super-Wideband \n");
417 printf("Side B Sending Wideband\n\n");
418 }
419
420 SetISAConfig(swbISACConfig, _acmA, _testMode);
421 SetISAConfig(wbISACConfig, _acmB, _testMode);
422
423 bool adaptiveMode = false;
424 if((swbISACConfig.currentRateBitPerSec == -1) ||
425 (wbISACConfig.currentRateBitPerSec == -1))
426 {
427 adaptiveMode = true;
428 }
429 _myTimer.Reset();
430 _channel_A2B->ResetStats();
431 _channel_B2A->ResetStats();
432
433 char currentTime[500];
434 if(_testMode == 2) printf("\n");
435 CodecInst sendCodec;
436 EventWrapper* myEvent = EventWrapper::Create();
437 myEvent->StartTimer(true, 10);
438 while(!(_inFileA.EndOfFile() || _inFileA.Rewinded()))
439 {
440 Run10ms();
441 _myTimer.Tick10ms();
442 _myTimer.CurrentTimeHMS(currentTime);
443 if(_testMode == 2) printf("\r%s ", currentTime);
444
445 if((adaptiveMode) && (_testMode != 0))
446 {
447 myEvent->Wait(5000);
448
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000449 _acmA->SendCodec(&sendCodec);
niklase@google.com470e71d2011-07-07 08:21:25 +0000450 if(_testMode == 2) printf("[%d] ", sendCodec.rate);
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000451 _acmB->SendCodec(&sendCodec);
niklase@google.com470e71d2011-07-07 08:21:25 +0000452 if(_testMode == 2) printf("[%d] ", sendCodec.rate);
453 }
454 }
455
456 if(_testMode != 0)
457 {
458 printf("\n\nSide A statistics\n\n");
459 _channel_A2B->PrintStats(_paramISAC32kHz);
460
461 printf("\n\nSide B statistics\n\n");
462 _channel_B2A->PrintStats(_paramISAC16kHz);
463 }
464
465 _channel_A2B->ResetStats();
466 _channel_B2A->ResetStats();
467
468 if(_testMode != 0) printf("\n");
469 _outFileA.Close();
470 _outFileB.Close();
471 _inFileA.Close();
472 _inFileB.Close();
473}
474
475void
476ISACTest::SwitchingSamplingRate(
477 int testNr,
478 int maxSampRateChange)
479{
niklase@google.com470e71d2011-07-07 08:21:25 +0000480 // Files in Side A
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000481 _inFileA.Open(file_name_swb_, 32000, "rb");
482 _inFileB.Open(file_name_swb_, 32000, "rb");
483
484 std::string file_name_out;
485 std::stringstream file_stream_a;
486 std::stringstream file_stream_b;
487 file_stream_a << webrtc::test::OutputPath();
488 file_stream_b << webrtc::test::OutputPath();
niklase@google.com470e71d2011-07-07 08:21:25 +0000489 if(_testMode == 0)
490 {
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000491 file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
492 file_stream_b << "out_iSACTest_B_" << testNr << ".pcm";
niklase@google.com470e71d2011-07-07 08:21:25 +0000493 }
494 else
495 {
496 printf("\nTest %d", testNr);
497 printf(" Alternate between WB and SWB at the sender Side\n\n");
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000498 file_stream_a << "outA_" << testNr << ".pcm";
499 file_stream_b << "outB_" << testNr << ".pcm";
niklase@google.com470e71d2011-07-07 08:21:25 +0000500 }
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000501 file_name_out = file_stream_a.str();
502 _outFileA.Open(file_name_out, 32000, "wb");
503 file_name_out = file_stream_b.str();
504 _outFileB.Open(file_name_out, 32000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000505
506 CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
507 CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
508 if(_testMode != 0)
509 {
510 printf("Side A Sending Super-Wideband \n");
511 printf("Side B Sending Wideband\n");
512 }
513
514 int numSendCodecChanged = 0;
515 _myTimer.Reset();
516 char currentTime[50];
517 while(numSendCodecChanged < (maxSampRateChange<<1))
518 {
519 Run10ms();
520 _myTimer.Tick10ms();
521 _myTimer.CurrentTimeHMS(currentTime);
522 if(_testMode == 2) printf("\r%s", currentTime);
523 if(_inFileA.EndOfFile())
524 {
525 if(_inFileA.SamplingFrequency() == 16000)
526 {
527 if(_testMode != 0) printf("\nSide A switched to Send Super-Wideband\n");
528 _inFileA.Close();
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000529 _inFileA.Open(file_name_swb_, 32000, "rb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000530 CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC32kHz));
531 }
532 else
533 {
534 if(_testMode != 0) printf("\nSide A switched to Send Wideband\n");
535 _inFileA.Close();
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000536 _inFileA.Open(file_name_swb_, 32000, "rb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000537 CHECK_ERROR(_acmA->RegisterSendCodec(_paramISAC16kHz));
538 }
539 numSendCodecChanged++;
540 }
541
542 if(_inFileB.EndOfFile())
543 {
544 if(_inFileB.SamplingFrequency() == 16000)
545 {
546 if(_testMode != 0) printf("\nSide B switched to Send Super-Wideband\n");
547 _inFileB.Close();
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000548 _inFileB.Open(file_name_swb_, 32000, "rb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000549 CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC32kHz));
550 }
551 else
552 {
553 if(_testMode != 0) printf("\nSide B switched to Send Wideband\n");
554 _inFileB.Close();
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000555 _inFileB.Open(file_name_swb_, 32000, "rb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000556 CHECK_ERROR(_acmB->RegisterSendCodec(_paramISAC16kHz));
557 }
558 numSendCodecChanged++;
559 }
560 }
561 _outFileA.Close();
562 _outFileB.Close();
563 _inFileA.Close();
564 _inFileB.Close();
565}
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +0000566
567} // namespace webrtc