| 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 |
| 11 #include "webrtc/modules/audio_coding/test/iSACTest.h" | 11 #include "webrtc/modules/audio_coding/test/iSACTest.h" |
| 12 | 12 |
| 13 #include <ctype.h> | 13 #include <ctype.h> |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <string.h> | 15 #include <string.h> |
| 16 | 16 |
| 17 #ifdef _WIN32 | 17 #ifdef _WIN32 |
| 18 #include <windows.h> | 18 #include <windows.h> |
| 19 #elif defined(WEBRTC_LINUX) | 19 #elif defined(WEBRTC_LINUX) |
| 20 #include <time.h> | 20 #include <time.h> |
| 21 #else | 21 #else |
| 22 #include <sys/time.h> | 22 #include <sys/time.h> |
| 23 #include <time.h> | 23 #include <time.h> |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" | 26 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" |
| 27 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" |
| 27 #include "webrtc/modules/audio_coding/test/utility.h" | 28 #include "webrtc/modules/audio_coding/test/utility.h" |
| 28 #include "webrtc/system_wrappers/include/event_wrapper.h" | 29 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 29 #include "webrtc/system_wrappers/include/trace.h" | 30 #include "webrtc/system_wrappers/include/trace.h" |
| 30 #include "webrtc/test/testsupport/fileutils.h" | 31 #include "webrtc/test/testsupport/fileutils.h" |
| 31 | 32 |
| 32 namespace webrtc { | 33 namespace webrtc { |
| 33 | 34 |
| 34 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) { | 35 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) { |
| 35 isacConfig.currentRateBitPerSec = 0; | 36 isacConfig.currentRateBitPerSec = 0; |
| 36 isacConfig.currentFrameSizeMsec = 0; | 37 isacConfig.currentFrameSizeMsec = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 _idISAC16kHz = codecCntr; | 88 _idISAC16kHz = codecCntr; |
| 88 } | 89 } |
| 89 if (!STR_CASE_CMP(codecParam.plname, "ISAC") | 90 if (!STR_CASE_CMP(codecParam.plname, "ISAC") |
| 90 && codecParam.plfreq == 32000) { | 91 && codecParam.plfreq == 32000) { |
| 91 memcpy(&_paramISAC32kHz, &codecParam, sizeof(CodecInst)); | 92 memcpy(&_paramISAC32kHz, &codecParam, sizeof(CodecInst)); |
| 92 _idISAC32kHz = codecCntr; | 93 _idISAC32kHz = codecCntr; |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 | 96 |
| 96 // Register both iSAC-wb & iSAC-swb in both sides as receiver codecs. | 97 // Register both iSAC-wb & iSAC-swb in both sides as receiver codecs. |
| 97 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(_paramISAC16kHz)); | 98 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(_paramISAC16kHz.pltype, |
| 98 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(_paramISAC32kHz)); | 99 CodecInstToSdp(_paramISAC16kHz))); |
| 99 EXPECT_EQ(0, _acmB->RegisterReceiveCodec(_paramISAC16kHz)); | 100 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(_paramISAC32kHz.pltype, |
| 100 EXPECT_EQ(0, _acmB->RegisterReceiveCodec(_paramISAC32kHz)); | 101 CodecInstToSdp(_paramISAC32kHz))); |
| 102 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(_paramISAC16kHz.pltype, |
| 103 CodecInstToSdp(_paramISAC16kHz))); |
| 104 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(_paramISAC32kHz.pltype, |
| 105 CodecInstToSdp(_paramISAC32kHz))); |
| 101 | 106 |
| 102 //--- Set A-to-B channel | 107 //--- Set A-to-B channel |
| 103 _channel_A2B.reset(new Channel); | 108 _channel_A2B.reset(new Channel); |
| 104 EXPECT_EQ(0, _acmA->RegisterTransportCallback(_channel_A2B.get())); | 109 EXPECT_EQ(0, _acmA->RegisterTransportCallback(_channel_A2B.get())); |
| 105 _channel_A2B->RegisterReceiverACM(_acmB.get()); | 110 _channel_A2B->RegisterReceiverACM(_acmB.get()); |
| 106 | 111 |
| 107 //--- Set B-to-A channel | 112 //--- Set B-to-A channel |
| 108 _channel_B2A.reset(new Channel); | 113 _channel_B2A.reset(new Channel); |
| 109 EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A.get())); | 114 EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A.get())); |
| 110 _channel_B2A->RegisterReceiverACM(_acmA.get()); | 115 _channel_B2A->RegisterReceiverACM(_acmA.get()); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 numSendCodecChanged++; | 341 numSendCodecChanged++; |
| 337 } | 342 } |
| 338 } | 343 } |
| 339 _outFileA.Close(); | 344 _outFileA.Close(); |
| 340 _outFileB.Close(); | 345 _outFileB.Close(); |
| 341 _inFileA.Close(); | 346 _inFileA.Close(); |
| 342 _inFileB.Close(); | 347 _inFileB.Close(); |
| 343 } | 348 } |
| 344 | 349 |
| 345 } // namespace webrtc | 350 } // namespace webrtc |
| OLD | NEW |