diff --git a/modules/audio_coding/test/EncodeDecodeTest.cc b/modules/audio_coding/test/EncodeDecodeTest.cc index 4d47e4efef..0bf4de5394 100644 --- a/modules/audio_coding/test/EncodeDecodeTest.cc +++ b/modules/audio_coding/test/EncodeDecodeTest.cc @@ -54,7 +54,6 @@ Sender::Sender() void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream, std::string in_file_name, int sample_rate, size_t channels) { struct CodecInst sendCodec; - int noOfCodecs = acm->NumberOfCodecs(); int codecNo; // Open input file @@ -69,19 +68,7 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream, _pcmFile.FastForward(100); // Set the codec for the current test. - if ((testMode == 0) || (testMode == 1)) { - // Set the codec id. - codecNo = codeId; - } else { - // Choose codec on command line. - printf("List of supported codec.\n"); - for (int n = 0; n < noOfCodecs; n++) { - EXPECT_EQ(0, acm->Codec(n, &sendCodec)); - printf("%d %s\n", n, sendCodec.plname); - } - printf("Choose your codec:"); - ASSERT_GT(scanf("%d", &codecNo), 0); - } + codecNo = codeId; EXPECT_EQ(0, acm->Codec(codecNo, &sendCodec)); @@ -150,21 +137,8 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream, file_name = file_stream.str(); _rtpStream = rtpStream; - if (testMode == 1) { - playSampFreq = recvCodec.plfreq; - _pcmFile.Open(file_name, recvCodec.plfreq, "wb+"); - } else if (testMode == 0) { - playSampFreq = 32000; - _pcmFile.Open(file_name, 32000, "wb+"); - } else { - printf("\nValid output frequencies:\n"); - printf("8000\n16000\n32000\n-1,"); - printf("which means output frequency equal to received signal frequency"); - printf("\n\nChoose output sampling frequency: "); - ASSERT_GT(scanf("%d", &playSampFreq), 0); - file_name = webrtc::test::OutputPath() + out_file_name + ".pcm"; - _pcmFile.Open(file_name, playSampFreq, "wb+"); - } + playSampFreq = 32000; + _pcmFile.Open(file_name, 32000, "wb+"); _realPayloadSizeBytes = 0; _playoutBuffer = new int16_t[WEBRTC_10MS_PCM_AUDIO]; @@ -249,15 +223,10 @@ void Receiver::Run() { } } -EncodeDecodeTest::EncodeDecodeTest() { - _testMode = 2; -} - -EncodeDecodeTest::EncodeDecodeTest(int testMode) { - //testMode == 0 for autotest - //testMode == 1 for testing all codecs/parameters - //testMode > 1 for specific user-input test (as it was used before) - _testMode = testMode; +EncodeDecodeTest::EncodeDecodeTest(int test_mode) { + // There used to be different test modes. The only one still supported is the + // "autotest" mode. + RTC_CHECK_EQ(0, test_mode); } void EncodeDecodeTest::Perform() { @@ -275,34 +244,27 @@ void EncodeDecodeTest::Perform() { struct CodecInst sendCodecTmp; numCodecs = acm->NumberOfCodecs(); - if (_testMode != 2) { - for (int n = 0; n < numCodecs; n++) { - EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp)); - if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) { - numPars[n] = 0; - } else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) { - numPars[n] = 0; - } else if (STR_CASE_CMP(sendCodecTmp.plname, "red") == 0) { - numPars[n] = 0; - } else if (sendCodecTmp.channels == 2) { - numPars[n] = 0; - } else { - numPars[n] = 1; - } + for (int n = 0; n < numCodecs; n++) { + EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp)); + if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) { + numPars[n] = 0; + } else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) { + numPars[n] = 0; + } else if (STR_CASE_CMP(sendCodecTmp.plname, "red") == 0) { + numPars[n] = 0; + } else if (sendCodecTmp.channels == 2) { + numPars[n] = 0; + } else { + numPars[n] = 1; } - } else { - numCodecs = 1; - numPars[0] = 1; } - _receiver.testMode = _testMode; - // Loop over all mono codecs: for (int codeId = 0; codeId < numCodecs; codeId++) { // Only encode using real mono encoders, not telephone-event and cng. for (int loopPars = 1; loopPars <= numPars[codeId]; loopPars++) { // Encode all data to file. - std::string fileName = EncodeToFile(1, codeId, codePars, _testMode); + std::string fileName = EncodeToFile(1, codeId, codePars); RTPFile rtpFile; rtpFile.Open(fileName.c_str(), "rb"); @@ -320,8 +282,7 @@ void EncodeDecodeTest::Perform() { std::string EncodeDecodeTest::EncodeToFile(int fileType, int codeId, - int* codePars, - int testMode) { + int* codePars) { std::unique_ptr acm(AudioCodingModule::Create( AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory()))); RTPFile rtpFile; @@ -331,7 +292,6 @@ std::string EncodeDecodeTest::EncodeToFile(int fileType, rtpFile.WriteHeader(); // Store for auto_test and logging. - _sender.testMode = testMode; _sender.codeId = codeId; _sender.Setup(acm.get(), &rtpFile, "audio_coding/testfile32kHz", 32000, 1); diff --git a/modules/audio_coding/test/EncodeDecodeTest.h b/modules/audio_coding/test/EncodeDecodeTest.h index 3855bc7d38..f1209c5594 100644 --- a/modules/audio_coding/test/EncodeDecodeTest.h +++ b/modules/audio_coding/test/EncodeDecodeTest.h @@ -54,8 +54,6 @@ class Sender { void Run(); bool Add10MsData(); - //for auto_test and logging - uint8_t testMode; uint8_t codeId; protected: @@ -80,7 +78,6 @@ class Receiver { //for auto_test and logging uint8_t codeId; - uint8_t testMode; private: PCMFile _pcmFile; @@ -101,18 +98,13 @@ class Receiver { class EncodeDecodeTest : public ACMTest { public: - EncodeDecodeTest(); - explicit EncodeDecodeTest(int testMode); + explicit EncodeDecodeTest(int test_mode); void Perform() override; uint16_t _playoutFreq; - uint8_t _testMode; private: - std::string EncodeToFile(int fileType, - int codeId, - int* codePars, - int testMode); + std::string EncodeToFile(int fileType, int codeId, int* codePars); protected: Sender _sender; diff --git a/modules/audio_coding/test/PacketLossTest.cc b/modules/audio_coding/test/PacketLossTest.cc index 45714c4bfd..d5fbfd1207 100644 --- a/modules/audio_coding/test/PacketLossTest.cc +++ b/modules/audio_coding/test/PacketLossTest.cc @@ -142,7 +142,6 @@ void PacketLossTest::Perform() { rtpFile.Open(fileName.c_str(), "wb+"); rtpFile.WriteHeader(); - sender_->testMode = 0; sender_->codeId = codec_id; sender_->Setup(acm.get(), &rtpFile, in_file_name_, sample_rate_hz_, channels_, @@ -157,7 +156,6 @@ void PacketLossTest::Perform() { rtpFile.Open(fileName.c_str(), "rb"); rtpFile.ReadHeader(); - receiver_->testMode = 0; receiver_->codeId = codec_id; receiver_->Setup(acm.get(), &rtpFile, "packetLoss_out", channels_,