AudioCodingModuleTest.TwoWayCommunication: Remove non-automatic mode
The tests only use the automatic mode, and I'd rather not maintain
(and test!) the rest.
Bug: webrtc:8396
Change-Id: I4cd1096e088d2ea8807a605b8448bd44ff9e88ed
Reviewed-on: https://webrtc-review.googlesource.com/102060
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24852}
diff --git a/modules/audio_coding/test/Tester.cc b/modules/audio_coding/test/Tester.cc
index b064225..4b15fcb 100644
--- a/modules/audio_coding/test/Tester.cc
+++ b/modules/audio_coding/test/Tester.cc
@@ -66,7 +66,7 @@
#else
TEST(AudioCodingModuleTest, TwoWayCommunication) {
#endif
- webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
+ webrtc::TwoWayCommunication().Perform();
}
#endif
diff --git a/modules/audio_coding/test/TwoWayCommunication.cc b/modules/audio_coding/test/TwoWayCommunication.cc
index 3c5b2fe..93ba4dd 100644
--- a/modules/audio_coding/test/TwoWayCommunication.cc
+++ b/modules/audio_coding/test/TwoWayCommunication.cc
@@ -32,12 +32,11 @@
#define MAX_FILE_NAME_LENGTH_BYTE 500
-TwoWayCommunication::TwoWayCommunication(int testMode)
+TwoWayCommunication::TwoWayCommunication()
: _acmA(AudioCodingModule::Create(
AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory()))),
_acmRefA(AudioCodingModule::Create(
- AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory()))),
- _testMode(testMode) {
+ AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory()))) {
AudioCodingModule::Config config;
// The clicks will be more obvious if time-stretching is not allowed.
// TODO(henrik.lundin) Really?
@@ -60,113 +59,6 @@
_outFileRefB.Close();
}
-void TwoWayCommunication::ChooseCodec(uint8_t* codecID_A, uint8_t* codecID_B) {
- std::unique_ptr<AudioCodingModule> tmpACM(AudioCodingModule::Create(
- AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory())));
- uint8_t noCodec = tmpACM->NumberOfCodecs();
- CodecInst codecInst;
- printf("List of Supported Codecs\n");
- printf("========================\n");
- for (uint8_t codecCntr = 0; codecCntr < noCodec; codecCntr++) {
- EXPECT_EQ(tmpACM->Codec(codecCntr, &codecInst), 0);
- printf("%d- %s\n", codecCntr, codecInst.plname);
- }
- printf("\nChoose a send codec for side A [0]: ");
- char myStr[15] = "";
- EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
- *codecID_A = (uint8_t)atoi(myStr);
-
- printf("\nChoose a send codec for side B [0]: ");
- EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL);
- *codecID_B = (uint8_t)atoi(myStr);
-
- printf("\n");
-}
-
-void TwoWayCommunication::SetUp() {
- uint8_t codecID_A;
- uint8_t codecID_B;
-
- ChooseCodec(&codecID_A, &codecID_B);
- CodecInst codecInst_A;
- CodecInst codecInst_B;
- CodecInst dummyCodec;
- EXPECT_EQ(0, _acmA->Codec(codecID_A, &codecInst_A));
- EXPECT_EQ(0, _acmB->Codec(codecID_B, &codecInst_B));
- EXPECT_EQ(0, _acmA->Codec(6, &dummyCodec));
-
- //--- Set A codecs
- EXPECT_EQ(0, _acmA->RegisterSendCodec(codecInst_A));
- EXPECT_EQ(true, _acmA->RegisterReceiveCodec(codecInst_B.pltype,
- CodecInstToSdp(codecInst_B)));
- //--- Set ref-A codecs
- EXPECT_EQ(0, _acmRefA->RegisterSendCodec(codecInst_A));
- EXPECT_EQ(true, _acmRefA->RegisterReceiveCodec(codecInst_B.pltype,
- CodecInstToSdp(codecInst_B)));
-
- //--- Set B codecs
- EXPECT_EQ(0, _acmB->RegisterSendCodec(codecInst_B));
- EXPECT_EQ(true, _acmB->RegisterReceiveCodec(codecInst_A.pltype,
- CodecInstToSdp(codecInst_A)));
-
- //--- Set ref-B codecs
- EXPECT_EQ(0, _acmRefB->RegisterSendCodec(codecInst_B));
- EXPECT_EQ(true, _acmRefB->RegisterReceiveCodec(codecInst_A.pltype,
- CodecInstToSdp(codecInst_A)));
-
- uint16_t frequencyHz;
-
- //--- Input A
- std::string in_file_name =
- webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
- frequencyHz = 32000;
- printf("Enter input file at side A [%s]: ", in_file_name.c_str());
- PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz);
- _inFileA.Open(in_file_name, frequencyHz, "rb");
-
- //--- Output A
- std::string out_file_a = webrtc::test::OutputPath() + "outA.pcm";
- printf("Output file at side A: %s\n", out_file_a.c_str());
- printf("Sampling frequency (in Hz) of the above file: %u\n", frequencyHz);
- _outFileA.Open(out_file_a, frequencyHz, "wb");
- std::string ref_file_name = webrtc::test::OutputPath() + "ref_outA.pcm";
- _outFileRefA.Open(ref_file_name, frequencyHz, "wb");
-
- //--- Input B
- in_file_name =
- webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
- frequencyHz = 32000;
- printf("\n\nEnter input file at side B [%s]: ", in_file_name.c_str());
- PCMFile::ChooseFile(&in_file_name, 499, &frequencyHz);
- _inFileB.Open(in_file_name, frequencyHz, "rb");
-
- //--- Output B
- std::string out_file_b = webrtc::test::OutputPath() + "outB.pcm";
- printf("Output file at side B: %s\n", out_file_b.c_str());
- printf("Sampling frequency (in Hz) of the above file: %u\n", frequencyHz);
- _outFileB.Open(out_file_b, frequencyHz, "wb");
- ref_file_name = webrtc::test::OutputPath() + "ref_outB.pcm";
- _outFileRefB.Open(ref_file_name, frequencyHz, "wb");
-
- //--- Set A-to-B channel
- _channel_A2B = new Channel;
- _acmA->RegisterTransportCallback(_channel_A2B);
- _channel_A2B->RegisterReceiverACM(_acmB.get());
- //--- Do the same for the reference
- _channelRef_A2B = new Channel;
- _acmRefA->RegisterTransportCallback(_channelRef_A2B);
- _channelRef_A2B->RegisterReceiverACM(_acmRefB.get());
-
- //--- Set B-to-A channel
- _channel_B2A = new Channel;
- _acmB->RegisterTransportCallback(_channel_B2A);
- _channel_B2A->RegisterReceiverACM(_acmA.get());
- //--- Do the same for reference
- _channelRef_B2A = new Channel;
- _acmRefB->RegisterTransportCallback(_channelRef_B2A);
- _channelRef_B2A->RegisterReceiverACM(_acmRefA.get());
-}
-
void TwoWayCommunication::SetUpAutotest() {
CodecInst codecInst_A;
CodecInst codecInst_B;
@@ -241,11 +133,7 @@
}
void TwoWayCommunication::Perform() {
- if (_testMode == 0) {
- SetUpAutotest();
- } else {
- SetUp();
- }
+ SetUpAutotest();
unsigned int msecPassed = 0;
unsigned int secPassed = 0;
diff --git a/modules/audio_coding/test/TwoWayCommunication.h b/modules/audio_coding/test/TwoWayCommunication.h
index f0becae..c32a34b 100644
--- a/modules/audio_coding/test/TwoWayCommunication.h
+++ b/modules/audio_coding/test/TwoWayCommunication.h
@@ -23,14 +23,12 @@
class TwoWayCommunication : public ACMTest {
public:
- explicit TwoWayCommunication(int testMode);
+ TwoWayCommunication();
~TwoWayCommunication();
void Perform();
private:
- void ChooseCodec(uint8_t* codecID_A, uint8_t* codecID_B);
- void SetUp();
void SetUpAutotest();
std::unique_ptr<AudioCodingModule> _acmA;
@@ -53,8 +51,6 @@
PCMFile _outFileRefA;
PCMFile _outFileRefB;
-
- int _testMode;
};
} // namespace webrtc