Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3926)

Side by Side Diff: webrtc/modules/audio_coding/main/test/TestRedFec.cc

Issue 1368843003: Don't link with audio codecs that we don't use (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add comment Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 const char kNameCN[] = "CN";
41 const char kNameRED[] = "RED";
42
43 // These three are only used by code #ifdeffed on WEBRTC_CODEC_G722.
44 #ifdef WEBRTC_CODEC_G722
40 const char kNameISAC[] = "ISAC"; 45 const char kNameISAC[] = "ISAC";
41 const char kNameG722[] = "G722"; 46 const char kNameG722[] = "G722";
42 const char kNameOPUS[] = "opus"; 47 const char kNameOPUS[] = "opus";
43 const char kNameCN[] = "CN"; 48 #endif
44 const char kNameRED[] = "RED";
45 } 49 }
46 50
47 TestRedFec::TestRedFec() 51 TestRedFec::TestRedFec()
48 : _acmA(AudioCodingModule::Create(0)), 52 : _acmA(AudioCodingModule::Create(0)),
49 _acmB(AudioCodingModule::Create(1)), 53 _acmB(AudioCodingModule::Create(1)),
50 _channelA2B(NULL), 54 _channelA2B(NULL),
51 _testCntr(0) { 55 _testCntr(0) {
52 } 56 }
53 57
54 TestRedFec::~TestRedFec() { 58 TestRedFec::~TestRedFec() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Switch to another 8 kHz codec, RED should remain switched on. 101 // Switch to another 8 kHz codec, RED should remain switched on.
98 EXPECT_TRUE(_acmA->REDStatus()); 102 EXPECT_TRUE(_acmA->REDStatus());
99 OpenOutFile(_testCntr); 103 OpenOutFile(_testCntr);
100 Run(); 104 Run();
101 _outFileB.Close(); 105 _outFileB.Close();
102 106
103 #ifndef WEBRTC_CODEC_G722 107 #ifndef WEBRTC_CODEC_G722
104 EXPECT_TRUE(false); 108 EXPECT_TRUE(false);
105 printf("G722 needs to be activated to run this test\n"); 109 printf("G722 needs to be activated to run this test\n");
106 return; 110 return;
107 #endif 111 #else
108 EXPECT_EQ(0, RegisterSendCodec('A', kNameG722, 16000)); 112 EXPECT_EQ(0, RegisterSendCodec('A', kNameG722, 16000));
109 EXPECT_EQ(0, RegisterSendCodec('A', kNameCN, 16000)); 113 EXPECT_EQ(0, RegisterSendCodec('A', kNameCN, 16000));
110 114
111 #ifdef SUPPORT_RED_WB 115 #ifdef SUPPORT_RED_WB
112 // Switch codec, RED should remain. 116 // Switch codec, RED should remain.
113 EXPECT_TRUE(_acmA->REDStatus()); 117 EXPECT_TRUE(_acmA->REDStatus());
114 #else 118 #else
115 // Switch to a 16 kHz codec, RED should have been switched off. 119 // Switch to a 16 kHz codec, RED should have been switched off.
116 EXPECT_FALSE(_acmA->REDStatus()); 120 EXPECT_FALSE(_acmA->REDStatus());
117 #endif 121 #endif
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // Codecs does not support internal FEC, disable FEC does not trigger failure. 405 // Codecs does not support internal FEC, disable FEC does not trigger failure.
402 RegisterSendCodec('A', kNameG722, 16000); 406 RegisterSendCodec('A', kNameG722, 16000);
403 EXPECT_FALSE(_acmA->REDStatus()); 407 EXPECT_FALSE(_acmA->REDStatus());
404 EXPECT_EQ(0, _acmA->SetCodecFEC(false)); 408 EXPECT_EQ(0, _acmA->SetCodecFEC(false));
405 EXPECT_FALSE(_acmA->CodecFEC()); 409 EXPECT_FALSE(_acmA->CodecFEC());
406 410
407 RegisterSendCodec('A', kNameISAC, 16000); 411 RegisterSendCodec('A', kNameISAC, 16000);
408 EXPECT_FALSE(_acmA->REDStatus()); 412 EXPECT_FALSE(_acmA->REDStatus());
409 EXPECT_EQ(0, _acmA->SetCodecFEC(false)); 413 EXPECT_EQ(0, _acmA->SetCodecFEC(false));
410 EXPECT_FALSE(_acmA->CodecFEC()); 414 EXPECT_FALSE(_acmA->CodecFEC());
415
416 #endif // defined(WEBRTC_CODEC_G722)
411 } 417 }
412 418
413 int32_t TestRedFec::SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode) { 419 int32_t TestRedFec::SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode) {
414 return _acmA->SetVAD(enableDTX, enableVAD, vadMode); 420 return _acmA->SetVAD(enableDTX, enableVAD, vadMode);
415 } 421 }
416 422
417 int16_t TestRedFec::RegisterSendCodec(char side, const char* codecName, 423 int16_t TestRedFec::RegisterSendCodec(char side, const char* codecName,
418 int32_t samplingFreqHz) { 424 int32_t samplingFreqHz) {
419 std::cout << std::flush; 425 std::cout << std::flush;
420 AudioCodingModule* myACM; 426 AudioCodingModule* myACM;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 std::string file_name; 467 std::string file_name;
462 std::stringstream file_stream; 468 std::stringstream file_stream;
463 file_stream << webrtc::test::OutputPath(); 469 file_stream << webrtc::test::OutputPath();
464 file_stream << "TestRedFec_outFile_"; 470 file_stream << "TestRedFec_outFile_";
465 file_stream << test_number << ".pcm"; 471 file_stream << test_number << ".pcm";
466 file_name = file_stream.str(); 472 file_name = file_stream.str();
467 _outFileB.Open(file_name, 16000, "wb"); 473 _outFileB.Open(file_name, 16000, "wb");
468 } 474 }
469 475
470 } // namespace webrtc 476 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/audio_coding_module.gypi ('k') | webrtc/modules/audio_coding/main/test/Tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698