| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ChooseCodec(&codecID_A, &codecID_B); | 90 ChooseCodec(&codecID_A, &codecID_B); |
| 91 CodecInst codecInst_A; | 91 CodecInst codecInst_A; |
| 92 CodecInst codecInst_B; | 92 CodecInst codecInst_B; |
| 93 CodecInst dummyCodec; | 93 CodecInst dummyCodec; |
| 94 EXPECT_EQ(0, _acmA->Codec(codecID_A, &codecInst_A)); | 94 EXPECT_EQ(0, _acmA->Codec(codecID_A, &codecInst_A)); |
| 95 EXPECT_EQ(0, _acmB->Codec(codecID_B, &codecInst_B)); | 95 EXPECT_EQ(0, _acmB->Codec(codecID_B, &codecInst_B)); |
| 96 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec)); | 96 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec)); |
| 97 | 97 |
| 98 //--- Set A codecs | 98 //--- Set A codecs |
| 99 EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A)); | 99 EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A)); |
| 100 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B)); | 100 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(codecInst_B.pltype, |
| 101 CodecInstToSdp(codecInst_B))); |
| 101 //--- Set ref-A codecs | 102 //--- Set ref-A codecs |
| 102 EXPECT_EQ(0, _acmRefA->RegisterSendCodec(codecInst_A)); | 103 EXPECT_EQ(0, _acmRefA->RegisterSendCodec(codecInst_A)); |
| 103 EXPECT_EQ(0, _acmRefA->RegisterReceiveCodec(codecInst_B)); | 104 EXPECT_EQ(true, _acmRefA->RegisterReceiveCodec(codecInst_B.pltype, |
| 105 CodecInstToSdp(codecInst_B))); |
| 104 | 106 |
| 105 //--- Set B codecs | 107 //--- Set B codecs |
| 106 EXPECT_EQ(0, _acmB->RegisterSendCodec(codecInst_B)); | 108 EXPECT_EQ(0, _acmB->RegisterSendCodec(codecInst_B)); |
| 107 EXPECT_EQ(0, _acmB->RegisterReceiveCodec(codecInst_A)); | 109 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(codecInst_A.pltype, |
| 110 CodecInstToSdp(codecInst_A))); |
| 108 | 111 |
| 109 //--- Set ref-B codecs | 112 //--- Set ref-B codecs |
| 110 EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B)); | 113 EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B)); |
| 111 EXPECT_EQ(0, _acmRefB->RegisterReceiveCodec(codecInst_A)); | 114 EXPECT_EQ(true, _acmRefB->RegisterReceiveCodec(codecInst_A.pltype, |
| 115 CodecInstToSdp(codecInst_A))); |
| 112 | 116 |
| 113 uint16_t frequencyHz; | 117 uint16_t frequencyHz; |
| 114 | 118 |
| 115 //--- Input A | 119 //--- Input A |
| 116 std::string in_file_name = webrtc::test::ResourcePath( | 120 std::string in_file_name = webrtc::test::ResourcePath( |
| 117 "audio_coding/testfile32kHz", "pcm"); | 121 "audio_coding/testfile32kHz", "pcm"); |
| 118 frequencyHz = 32000; | 122 frequencyHz = 32000; |
| 119 printf("Enter input file at side A [%s]: ", in_file_name.c_str()); | 123 printf("Enter input file at side A [%s]: ", in_file_name.c_str()); |
| 120 PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz); | 124 PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz); |
| 121 _inFileA.Open(in_file_name, frequencyHz, "rb"); | 125 _inFileA.Open(in_file_name, frequencyHz, "rb"); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 CodecInst codecInst_A; | 171 CodecInst codecInst_A; |
| 168 CodecInst codecInst_B; | 172 CodecInst codecInst_B; |
| 169 CodecInst dummyCodec; | 173 CodecInst dummyCodec; |
| 170 | 174 |
| 171 EXPECT_EQ(0, _acmA->Codec("ISAC", &codecInst_A, 16000, 1)); | 175 EXPECT_EQ(0, _acmA->Codec("ISAC", &codecInst_A, 16000, 1)); |
| 172 EXPECT_EQ(0, _acmB->Codec("L16", &codecInst_B, 8000, 1)); | 176 EXPECT_EQ(0, _acmB->Codec("L16", &codecInst_B, 8000, 1)); |
| 173 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec)); | 177 EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec)); |
| 174 | 178 |
| 175 //--- Set A codecs | 179 //--- Set A codecs |
| 176 EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A)); | 180 EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A)); |
| 177 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B)); | 181 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(codecInst_B.pltype, |
| 182 CodecInstToSdp(codecInst_B))); |
| 178 | 183 |
| 179 //--- Set ref-A codecs | 184 //--- Set ref-A codecs |
| 180 EXPECT_GT(_acmRefA->RegisterSendCodec(codecInst_A), -1); | 185 EXPECT_GT(_acmRefA->RegisterSendCodec(codecInst_A), -1); |
| 181 EXPECT_GT(_acmRefA->RegisterReceiveCodec(codecInst_B), -1); | 186 EXPECT_EQ(true, _acmRefA->RegisterReceiveCodec(codecInst_B.pltype, |
| 187 CodecInstToSdp(codecInst_B))); |
| 182 | 188 |
| 183 //--- Set B codecs | 189 //--- Set B codecs |
| 184 EXPECT_GT(_acmB->RegisterSendCodec(codecInst_B), -1); | 190 EXPECT_GT(_acmB->RegisterSendCodec(codecInst_B), -1); |
| 185 EXPECT_GT(_acmB->RegisterReceiveCodec(codecInst_A), -1); | 191 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(codecInst_A.pltype, |
| 192 CodecInstToSdp(codecInst_A))); |
| 186 | 193 |
| 187 //--- Set ref-B codecs | 194 //--- Set ref-B codecs |
| 188 EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B)); | 195 EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B)); |
| 189 EXPECT_EQ(0, _acmRefB->RegisterReceiveCodec(codecInst_A)); | 196 EXPECT_EQ(true, _acmRefB->RegisterReceiveCodec(codecInst_A.pltype, |
| 197 CodecInstToSdp(codecInst_A))); |
| 190 | 198 |
| 191 uint16_t frequencyHz; | 199 uint16_t frequencyHz; |
| 192 | 200 |
| 193 //--- Input A and B | 201 //--- Input A and B |
| 194 std::string in_file_name = webrtc::test::ResourcePath( | 202 std::string in_file_name = webrtc::test::ResourcePath( |
| 195 "audio_coding/testfile32kHz", "pcm"); | 203 "audio_coding/testfile32kHz", "pcm"); |
| 196 frequencyHz = 16000; | 204 frequencyHz = 16000; |
| 197 _inFileA.Open(in_file_name, frequencyHz, "rb"); | 205 _inFileA.Open(in_file_name, frequencyHz, "rb"); |
| 198 _inFileB.Open(in_file_name, frequencyHz, "rb"); | 206 _inFileB.Open(in_file_name, frequencyHz, "rb"); |
| 199 | 207 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // Re-register send codec on side B. | 293 // Re-register send codec on side B. |
| 286 if (((secPassed % 5) == 4) && (msecPassed >= 990)) { | 294 if (((secPassed % 5) == 4) && (msecPassed >= 990)) { |
| 287 EXPECT_EQ(0, _acmB->RegisterSendCodec(*codecInst_B)); | 295 EXPECT_EQ(0, _acmB->RegisterSendCodec(*codecInst_B)); |
| 288 EXPECT_TRUE(_acmB->SendCodec()); | 296 EXPECT_TRUE(_acmB->SendCodec()); |
| 289 } | 297 } |
| 290 // Initialize receiver on side A. | 298 // Initialize receiver on side A. |
| 291 if (((secPassed % 7) == 6) && (msecPassed == 0)) | 299 if (((secPassed % 7) == 6) && (msecPassed == 0)) |
| 292 EXPECT_EQ(0, _acmA->InitializeReceiver()); | 300 EXPECT_EQ(0, _acmA->InitializeReceiver()); |
| 293 // Re-register codec on side A. | 301 // Re-register codec on side A. |
| 294 if (((secPassed % 7) == 6) && (msecPassed >= 990)) { | 302 if (((secPassed % 7) == 6) && (msecPassed >= 990)) { |
| 295 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(*codecInst_B)); | 303 EXPECT_EQ(true, _acmA->RegisterReceiveCodec( |
| 304 codecInst_B->pltype, CodecInstToSdp(*codecInst_B))); |
| 296 } | 305 } |
| 297 } | 306 } |
| 298 } | 307 } |
| 299 | 308 |
| 300 } // namespace webrtc | 309 } // namespace webrtc |
| OLD | NEW |