Remove support for old test modes in EncodeDecodeTest
This test is so old, it used to be interactive with an automated mode
bolted on to the side. That automatic mode is the only one that's used
nowadays.
Bug: webrtc:8396
Change-Id: I3b473f53ff6afa363b9691e8471a5754f46d3d3f
Reviewed-on: https://webrtc-review.googlesource.com/83583
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23620}
diff --git a/modules/audio_coding/test/EncodeDecodeTest.cc b/modules/audio_coding/test/EncodeDecodeTest.cc
index 4d47e4e..0bf4de5 100644
--- a/modules/audio_coding/test/EncodeDecodeTest.cc
+++ b/modules/audio_coding/test/EncodeDecodeTest.cc
@@ -54,7 +54,6 @@
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 @@
_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 @@
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 @@
}
}
-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 @@
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 @@
std::string EncodeDecodeTest::EncodeToFile(int fileType,
int codeId,
- int* codePars,
- int testMode) {
+ int* codePars) {
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(
AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory())));
RTPFile rtpFile;
@@ -331,7 +292,6 @@
rtpFile.WriteHeader();
// Store for auto_test and logging.
- _sender.testMode = testMode;
_sender.codeId = codeId;
_sender.Setup(acm.get(), &rtpFile, "audio_coding/testfile32kHz", 32000, 1);