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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #ifdef SUPPORT_RED_FB | 31 #ifdef SUPPORT_RED_FB |
32 #undef SUPPORT_RED_FB | 32 #undef SUPPORT_RED_FB |
33 #endif | 33 #endif |
34 | 34 |
35 namespace webrtc { | 35 namespace webrtc { |
36 | 36 |
37 namespace { | 37 namespace { |
38 const char kNameL16[] = "L16"; | 38 const char kNameL16[] = "L16"; |
39 const char kNamePCMU[] = "PCMU"; | 39 const char kNamePCMU[] = "PCMU"; |
40 #ifdef WEBRTC_CODEC_G722 | |
hlundin-webrtc
2015/09/30 12:53:27
Please, comment on what is going on here. Courtesy
kwiberg-webrtc
2015/09/30 13:25:41
Done.
| |
40 const char kNameISAC[] = "ISAC"; | 41 const char kNameISAC[] = "ISAC"; |
41 const char kNameG722[] = "G722"; | 42 const char kNameG722[] = "G722"; |
42 const char kNameOPUS[] = "opus"; | 43 const char kNameOPUS[] = "opus"; |
44 #endif | |
43 const char kNameCN[] = "CN"; | 45 const char kNameCN[] = "CN"; |
44 const char kNameRED[] = "RED"; | 46 const char kNameRED[] = "RED"; |
45 } | 47 } |
46 | 48 |
47 TestRedFec::TestRedFec() | 49 TestRedFec::TestRedFec() |
48 : _acmA(AudioCodingModule::Create(0)), | 50 : _acmA(AudioCodingModule::Create(0)), |
49 _acmB(AudioCodingModule::Create(1)), | 51 _acmB(AudioCodingModule::Create(1)), |
50 _channelA2B(NULL), | 52 _channelA2B(NULL), |
51 _testCntr(0) { | 53 _testCntr(0) { |
52 } | 54 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 // Switch to another 8 kHz codec, RED should remain switched on. | 99 // Switch to another 8 kHz codec, RED should remain switched on. |
98 EXPECT_TRUE(_acmA->REDStatus()); | 100 EXPECT_TRUE(_acmA->REDStatus()); |
99 OpenOutFile(_testCntr); | 101 OpenOutFile(_testCntr); |
100 Run(); | 102 Run(); |
101 _outFileB.Close(); | 103 _outFileB.Close(); |
102 | 104 |
103 #ifndef WEBRTC_CODEC_G722 | 105 #ifndef WEBRTC_CODEC_G722 |
104 EXPECT_TRUE(false); | 106 EXPECT_TRUE(false); |
105 printf("G722 needs to be activated to run this test\n"); | 107 printf("G722 needs to be activated to run this test\n"); |
106 return; | 108 return; |
107 #endif | 109 #else |
108 EXPECT_EQ(0, RegisterSendCodec('A', kNameG722, 16000)); | 110 EXPECT_EQ(0, RegisterSendCodec('A', kNameG722, 16000)); |
109 EXPECT_EQ(0, RegisterSendCodec('A', kNameCN, 16000)); | 111 EXPECT_EQ(0, RegisterSendCodec('A', kNameCN, 16000)); |
110 | 112 |
111 #ifdef SUPPORT_RED_WB | 113 #ifdef SUPPORT_RED_WB |
112 // Switch codec, RED should remain. | 114 // Switch codec, RED should remain. |
113 EXPECT_TRUE(_acmA->REDStatus()); | 115 EXPECT_TRUE(_acmA->REDStatus()); |
114 #else | 116 #else |
115 // Switch to a 16 kHz codec, RED should have been switched off. | 117 // Switch to a 16 kHz codec, RED should have been switched off. |
116 EXPECT_FALSE(_acmA->REDStatus()); | 118 EXPECT_FALSE(_acmA->REDStatus()); |
117 #endif | 119 #endif |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 // Codecs does not support internal FEC, disable FEC does not trigger failure. | 403 // Codecs does not support internal FEC, disable FEC does not trigger failure. |
402 RegisterSendCodec('A', kNameG722, 16000); | 404 RegisterSendCodec('A', kNameG722, 16000); |
403 EXPECT_FALSE(_acmA->REDStatus()); | 405 EXPECT_FALSE(_acmA->REDStatus()); |
404 EXPECT_EQ(0, _acmA->SetCodecFEC(false)); | 406 EXPECT_EQ(0, _acmA->SetCodecFEC(false)); |
405 EXPECT_FALSE(_acmA->CodecFEC()); | 407 EXPECT_FALSE(_acmA->CodecFEC()); |
406 | 408 |
407 RegisterSendCodec('A', kNameISAC, 16000); | 409 RegisterSendCodec('A', kNameISAC, 16000); |
408 EXPECT_FALSE(_acmA->REDStatus()); | 410 EXPECT_FALSE(_acmA->REDStatus()); |
409 EXPECT_EQ(0, _acmA->SetCodecFEC(false)); | 411 EXPECT_EQ(0, _acmA->SetCodecFEC(false)); |
410 EXPECT_FALSE(_acmA->CodecFEC()); | 412 EXPECT_FALSE(_acmA->CodecFEC()); |
413 | |
414 #endif // defined(WEBRTC_CODEC_G722) | |
411 } | 415 } |
412 | 416 |
413 int32_t TestRedFec::SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode) { | 417 int32_t TestRedFec::SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode) { |
414 return _acmA->SetVAD(enableDTX, enableVAD, vadMode); | 418 return _acmA->SetVAD(enableDTX, enableVAD, vadMode); |
415 } | 419 } |
416 | 420 |
417 int16_t TestRedFec::RegisterSendCodec(char side, const char* codecName, | 421 int16_t TestRedFec::RegisterSendCodec(char side, const char* codecName, |
418 int32_t samplingFreqHz) { | 422 int32_t samplingFreqHz) { |
419 std::cout << std::flush; | 423 std::cout << std::flush; |
420 AudioCodingModule* myACM; | 424 AudioCodingModule* myACM; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 std::string file_name; | 465 std::string file_name; |
462 std::stringstream file_stream; | 466 std::stringstream file_stream; |
463 file_stream << webrtc::test::OutputPath(); | 467 file_stream << webrtc::test::OutputPath(); |
464 file_stream << "TestRedFec_outFile_"; | 468 file_stream << "TestRedFec_outFile_"; |
465 file_stream << test_number << ".pcm"; | 469 file_stream << test_number << ".pcm"; |
466 file_name = file_stream.str(); | 470 file_name = file_stream.str(); |
467 _outFileB.Open(file_name, 16000, "wb"); | 471 _outFileB.Open(file_name, 16000, "wb"); |
468 } | 472 } |
469 | 473 |
470 } // namespace webrtc | 474 } // namespace webrtc |
OLD | NEW |