| 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 14 matching lines...) Expand all Loading... |
| 25 #include "webrtc/modules/audio_coding/main/test/utility.h" | 25 #include "webrtc/modules/audio_coding/main/test/utility.h" |
| 26 #include "webrtc/system_wrappers/interface/trace.h" | 26 #include "webrtc/system_wrappers/interface/trace.h" |
| 27 #include "webrtc/test/testsupport/fileutils.h" | 27 #include "webrtc/test/testsupport/fileutils.h" |
| 28 | 28 |
| 29 namespace webrtc { | 29 namespace webrtc { |
| 30 | 30 |
| 31 #define MAX_FILE_NAME_LENGTH_BYTE 500 | 31 #define MAX_FILE_NAME_LENGTH_BYTE 500 |
| 32 | 32 |
| 33 TwoWayCommunication::TwoWayCommunication(int testMode) | 33 TwoWayCommunication::TwoWayCommunication(int testMode) |
| 34 : _acmA(AudioCodingModule::Create(1)), | 34 : _acmA(AudioCodingModule::Create(1)), |
| 35 _acmB(AudioCodingModule::Create(2)), | |
| 36 _acmRefA(AudioCodingModule::Create(3)), | 35 _acmRefA(AudioCodingModule::Create(3)), |
| 37 _acmRefB(AudioCodingModule::Create(4)), | 36 _testMode(testMode) { |
| 38 _testMode(testMode) {} | 37 AudioCodingModule::Config config; |
| 38 // The clicks will be more obvious in FAX mode. TODO(henrik.lundin) Really? |
| 39 config.neteq_config.playout_mode = kPlayoutFax; |
| 40 config.id = 2; |
| 41 _acmB.reset(AudioCodingModule::Create(config)); |
| 42 config.id = 4; |
| 43 _acmRefB.reset(AudioCodingModule::Create(config)); |
| 44 } |
| 39 | 45 |
| 40 TwoWayCommunication::~TwoWayCommunication() { | 46 TwoWayCommunication::~TwoWayCommunication() { |
| 41 delete _channel_A2B; | 47 delete _channel_A2B; |
| 42 delete _channel_B2A; | 48 delete _channel_B2A; |
| 43 delete _channelRef_A2B; | 49 delete _channelRef_A2B; |
| 44 delete _channelRef_B2A; | 50 delete _channelRef_B2A; |
| 45 #ifdef WEBRTC_DTMF_DETECTION | 51 #ifdef WEBRTC_DTMF_DETECTION |
| 46 if (_dtmfDetectorA != NULL) { | 52 if (_dtmfDetectorA != NULL) { |
| 47 delete _dtmfDetectorA; | 53 delete _dtmfDetectorA; |
| 48 } | 54 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 _channelRef_A2B->RegisterReceiverACM(_acmRefB.get()); | 158 _channelRef_A2B->RegisterReceiverACM(_acmRefB.get()); |
| 153 | 159 |
| 154 //--- Set B-to-A channel | 160 //--- Set B-to-A channel |
| 155 _channel_B2A = new Channel; | 161 _channel_B2A = new Channel; |
| 156 _acmB->RegisterTransportCallback(_channel_B2A); | 162 _acmB->RegisterTransportCallback(_channel_B2A); |
| 157 _channel_B2A->RegisterReceiverACM(_acmA.get()); | 163 _channel_B2A->RegisterReceiverACM(_acmA.get()); |
| 158 //--- Do the same for reference | 164 //--- Do the same for reference |
| 159 _channelRef_B2A = new Channel; | 165 _channelRef_B2A = new Channel; |
| 160 _acmRefB->RegisterTransportCallback(_channelRef_B2A); | 166 _acmRefB->RegisterTransportCallback(_channelRef_B2A); |
| 161 _channelRef_B2A->RegisterReceiverACM(_acmRefA.get()); | 167 _channelRef_B2A->RegisterReceiverACM(_acmRefA.get()); |
| 162 | |
| 163 // The clicks will be more obvious when we | |
| 164 // are in FAX mode. | |
| 165 EXPECT_EQ(_acmB->SetPlayoutMode(fax), 0); | |
| 166 EXPECT_EQ(_acmRefB->SetPlayoutMode(fax), 0); | |
| 167 } | 168 } |
| 168 | 169 |
| 169 void TwoWayCommunication::SetUpAutotest() { | 170 void TwoWayCommunication::SetUpAutotest() { |
| 170 CodecInst codecInst_A; | 171 CodecInst codecInst_A; |
| 171 CodecInst codecInst_B; | 172 CodecInst codecInst_B; |
| 172 CodecInst dummyCodec; | 173 CodecInst dummyCodec; |
| 173 | 174 |
| 174 EXPECT_EQ(0, _acmA->Codec("ISAC", &codecInst_A, 16000, 1)); | 175 EXPECT_EQ(0, _acmA->Codec("ISAC", &codecInst_A, 16000, 1)); |
| 175 EXPECT_EQ(0, _acmB->Codec("L16", &codecInst_B, 8000, 1)); | 176 EXPECT_EQ(0, _acmB->Codec("L16", &codecInst_B, 8000, 1)); |
| 176 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec)); | 177 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 _channelRef_A2B->RegisterReceiverACM(_acmRefB.get()); | 227 _channelRef_A2B->RegisterReceiverACM(_acmRefB.get()); |
| 227 | 228 |
| 228 //--- Set B-to-A channel | 229 //--- Set B-to-A channel |
| 229 _channel_B2A = new Channel; | 230 _channel_B2A = new Channel; |
| 230 _acmB->RegisterTransportCallback(_channel_B2A); | 231 _acmB->RegisterTransportCallback(_channel_B2A); |
| 231 _channel_B2A->RegisterReceiverACM(_acmA.get()); | 232 _channel_B2A->RegisterReceiverACM(_acmA.get()); |
| 232 //--- Do the same for reference | 233 //--- Do the same for reference |
| 233 _channelRef_B2A = new Channel; | 234 _channelRef_B2A = new Channel; |
| 234 _acmRefB->RegisterTransportCallback(_channelRef_B2A); | 235 _acmRefB->RegisterTransportCallback(_channelRef_B2A); |
| 235 _channelRef_B2A->RegisterReceiverACM(_acmRefA.get()); | 236 _channelRef_B2A->RegisterReceiverACM(_acmRefA.get()); |
| 236 | |
| 237 // The clicks will be more obvious when we | |
| 238 // are in FAX mode. | |
| 239 EXPECT_EQ(0, _acmB->SetPlayoutMode(fax)); | |
| 240 EXPECT_EQ(0, _acmRefB->SetPlayoutMode(fax)); | |
| 241 } | 237 } |
| 242 | 238 |
| 243 void TwoWayCommunication::Perform() { | 239 void TwoWayCommunication::Perform() { |
| 244 if (_testMode == 0) { | 240 if (_testMode == 0) { |
| 245 SetUpAutotest(); | 241 SetUpAutotest(); |
| 246 } else { | 242 } else { |
| 247 SetUp(); | 243 SetUp(); |
| 248 } | 244 } |
| 249 unsigned int msecPassed = 0; | 245 unsigned int msecPassed = 0; |
| 250 unsigned int secPassed = 0; | 246 unsigned int secPassed = 0; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (((secPassed % 7) == 6) && (msecPassed == 0)) | 292 if (((secPassed % 7) == 6) && (msecPassed == 0)) |
| 297 EXPECT_EQ(0, _acmA->InitializeReceiver()); | 293 EXPECT_EQ(0, _acmA->InitializeReceiver()); |
| 298 // Re-register codec on side A. | 294 // Re-register codec on side A. |
| 299 if (((secPassed % 7) == 6) && (msecPassed >= 990)) { | 295 if (((secPassed % 7) == 6) && (msecPassed >= 990)) { |
| 300 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B)); | 296 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B)); |
| 301 } | 297 } |
| 302 } | 298 } |
| 303 } | 299 } |
| 304 | 300 |
| 305 } // namespace webrtc | 301 } // namespace webrtc |
| OLD | NEW |