| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 isacConfig.initFrameSizeInMsec = 0; | 40 isacConfig.initFrameSizeInMsec = 0; |
| 41 isacConfig.enforceFrameSize = false; | 41 isacConfig.enforceFrameSize = false; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 int16_t SetISAConfig(ACMTestISACConfig& isacConfig, AudioCodingModule* acm, | 45 int16_t SetISAConfig(ACMTestISACConfig& isacConfig, AudioCodingModule* acm, |
| 46 int testMode) { | 46 int testMode) { |
| 47 | 47 |
| 48 if ((isacConfig.currentRateBitPerSec != 0) | 48 if ((isacConfig.currentRateBitPerSec != 0) |
| 49 || (isacConfig.currentFrameSizeMsec != 0)) { | 49 || (isacConfig.currentFrameSizeMsec != 0)) { |
| 50 CodecInst sendCodec; | 50 auto sendCodec = acm->SendCodec(); |
| 51 EXPECT_EQ(0, acm->SendCodec(&sendCodec)); | 51 EXPECT_TRUE(sendCodec); |
| 52 if (isacConfig.currentRateBitPerSec < 0) { | 52 if (isacConfig.currentRateBitPerSec < 0) { |
| 53 // Register iSAC in adaptive (channel-dependent) mode. | 53 // Register iSAC in adaptive (channel-dependent) mode. |
| 54 sendCodec.rate = -1; | 54 sendCodec->rate = -1; |
| 55 EXPECT_EQ(0, acm->RegisterSendCodec(sendCodec)); | 55 EXPECT_EQ(0, acm->RegisterSendCodec(*sendCodec)); |
| 56 } else { | 56 } else { |
| 57 if (isacConfig.currentRateBitPerSec != 0) { | 57 if (isacConfig.currentRateBitPerSec != 0) { |
| 58 sendCodec.rate = isacConfig.currentRateBitPerSec; | 58 sendCodec->rate = isacConfig.currentRateBitPerSec; |
| 59 } | 59 } |
| 60 if (isacConfig.currentFrameSizeMsec != 0) { | 60 if (isacConfig.currentFrameSizeMsec != 0) { |
| 61 sendCodec.pacsize = isacConfig.currentFrameSizeMsec | 61 sendCodec->pacsize = isacConfig.currentFrameSizeMsec |
| 62 * (sendCodec.plfreq / 1000); | 62 * (sendCodec->plfreq / 1000); |
| 63 } | 63 } |
| 64 EXPECT_EQ(0, acm->RegisterSendCodec(sendCodec)); | 64 EXPECT_EQ(0, acm->RegisterSendCodec(*sendCodec)); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 return 0; | 68 return 0; |
| 69 } | 69 } |
| 70 | 70 |
| 71 ISACTest::ISACTest(int testMode) | 71 ISACTest::ISACTest(int testMode) |
| 72 : _acmA(AudioCodingModule::Create(1)), | 72 : _acmA(AudioCodingModule::Create(1)), |
| 73 _acmB(AudioCodingModule::Create(2)), | 73 _acmB(AudioCodingModule::Create(2)), |
| 74 _testMode(testMode) {} | 74 _testMode(testMode) {} |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 bool adaptiveMode = false; | 231 bool adaptiveMode = false; |
| 232 if ((swbISACConfig.currentRateBitPerSec == -1) | 232 if ((swbISACConfig.currentRateBitPerSec == -1) |
| 233 || (wbISACConfig.currentRateBitPerSec == -1)) { | 233 || (wbISACConfig.currentRateBitPerSec == -1)) { |
| 234 adaptiveMode = true; | 234 adaptiveMode = true; |
| 235 } | 235 } |
| 236 _myTimer.Reset(); | 236 _myTimer.Reset(); |
| 237 _channel_A2B->ResetStats(); | 237 _channel_A2B->ResetStats(); |
| 238 _channel_B2A->ResetStats(); | 238 _channel_B2A->ResetStats(); |
| 239 | 239 |
| 240 char currentTime[500]; | 240 char currentTime[500]; |
| 241 CodecInst sendCodec; | |
| 242 EventTimerWrapper* myEvent = EventTimerWrapper::Create(); | 241 EventTimerWrapper* myEvent = EventTimerWrapper::Create(); |
| 243 EXPECT_TRUE(myEvent->StartTimer(true, 10)); | 242 EXPECT_TRUE(myEvent->StartTimer(true, 10)); |
| 244 while (!(_inFileA.EndOfFile() || _inFileA.Rewinded())) { | 243 while (!(_inFileA.EndOfFile() || _inFileA.Rewinded())) { |
| 245 Run10ms(); | 244 Run10ms(); |
| 246 _myTimer.Tick10ms(); | 245 _myTimer.Tick10ms(); |
| 247 _myTimer.CurrentTimeHMS(currentTime); | 246 _myTimer.CurrentTimeHMS(currentTime); |
| 248 | 247 |
| 249 if ((adaptiveMode) && (_testMode != 0)) { | 248 if ((adaptiveMode) && (_testMode != 0)) { |
| 250 myEvent->Wait(5000); | 249 myEvent->Wait(5000); |
| 251 EXPECT_EQ(0, _acmA->SendCodec(&sendCodec)); | 250 EXPECT_TRUE(_acmA->SendCodec()); |
| 252 EXPECT_EQ(0, _acmB->SendCodec(&sendCodec)); | 251 EXPECT_TRUE(_acmB->SendCodec()); |
| 253 } | 252 } |
| 254 } | 253 } |
| 255 | 254 |
| 256 if (_testMode != 0) { | 255 if (_testMode != 0) { |
| 257 printf("\n\nSide A statistics\n\n"); | 256 printf("\n\nSide A statistics\n\n"); |
| 258 _channel_A2B->PrintStats(_paramISAC32kHz); | 257 _channel_A2B->PrintStats(_paramISAC32kHz); |
| 259 | 258 |
| 260 printf("\n\nSide B statistics\n\n"); | 259 printf("\n\nSide B statistics\n\n"); |
| 261 _channel_B2A->PrintStats(_paramISAC16kHz); | 260 _channel_B2A->PrintStats(_paramISAC16kHz); |
| 262 } | 261 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 numSendCodecChanged++; | 330 numSendCodecChanged++; |
| 332 } | 331 } |
| 333 } | 332 } |
| 334 _outFileA.Close(); | 333 _outFileA.Close(); |
| 335 _outFileB.Close(); | 334 _outFileB.Close(); |
| 336 _inFileA.Close(); | 335 _inFileA.Close(); |
| 337 _inFileB.Close(); | 336 _inFileB.Close(); |
| 338 } | 337 } |
| 339 | 338 |
| 340 } // namespace webrtc | 339 } // namespace webrtc |
| OLD | NEW |