turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
pbos@webrtc.org | 12dc1a3 | 2013-08-05 16:22:53 +0000 | [diff] [blame] | 11 | #include <assert.h> |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 12 | #include <math.h> |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 13 | #include <string.h> |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 14 | |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 15 | #include <iostream> |
kwiberg | 3747838 | 2016-02-14 20:40:57 -0800 | [diff] [blame] | 16 | #include <memory> |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 17 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 18 | #include "common_types.h" // NOLINT(build/include) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 19 | #include "modules/audio_coding/codecs/audio_format_conversion.h" |
| 20 | #include "modules/audio_coding/include/audio_coding_module.h" |
| 21 | #include "modules/audio_coding/include/audio_coding_module_typedefs.h" |
| 22 | #include "modules/audio_coding/test/Channel.h" |
| 23 | #include "modules/audio_coding/test/PCMFile.h" |
| 24 | #include "modules/audio_coding/test/utility.h" |
| 25 | #include "rtc_base/flags.h" |
| 26 | #include "system_wrappers/include/event_wrapper.h" |
| 27 | #include "test/gtest.h" |
| 28 | #include "test/testsupport/fileutils.h" |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 29 | #include "typedefs.h" // NOLINT(build/include) |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 30 | |
| 31 | DEFINE_string(codec, "isac", "Codec Name"); |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 32 | DEFINE_int(sample_rate_hz, 16000, "Sampling rate in Hertz."); |
| 33 | DEFINE_int(num_channels, 1, "Number of Channels."); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 34 | DEFINE_string(input_file, "", "Input file, PCM16 32 kHz, optional."); |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 35 | DEFINE_int(delay, 0, "Delay in millisecond."); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 36 | DEFINE_bool(dtx, false, "Enable DTX at the sender side."); |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 37 | DEFINE_bool(packet_loss, false, "Apply packet loss, c.f. Channel{.cc, .h}."); |
| 38 | DEFINE_bool(fec, false, "Use Forward Error Correction (FEC)."); |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 39 | DEFINE_bool(help, false, "Print this message."); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 40 | |
| 41 | namespace webrtc { |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 42 | |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 43 | namespace { |
| 44 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 45 | struct CodecSettings { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 46 | char name[50]; |
| 47 | int sample_rate_hz; |
| 48 | int num_channels; |
| 49 | }; |
| 50 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 51 | struct AcmSettings { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 52 | bool dtx; |
| 53 | bool fec; |
| 54 | }; |
| 55 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 56 | struct TestSettings { |
| 57 | CodecSettings codec; |
| 58 | AcmSettings acm; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 59 | bool packet_loss; |
| 60 | }; |
| 61 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 62 | } // namespace |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 63 | |
| 64 | class DelayTest { |
| 65 | public: |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 66 | DelayTest() |
| 67 | : acm_a_(AudioCodingModule::Create(0)), |
| 68 | acm_b_(AudioCodingModule::Create(1)), |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 69 | channel_a2b_(new Channel), |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 70 | test_cntr_(0), |
| 71 | encoding_sample_rate_hz_(8000) {} |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 72 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 73 | ~DelayTest() { |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 74 | if (channel_a2b_ != NULL) { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 75 | delete channel_a2b_; |
| 76 | channel_a2b_ = NULL; |
| 77 | } |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 78 | in_file_a_.Close(); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 79 | } |
| 80 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 81 | void Initialize() { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 82 | test_cntr_ = 0; |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 83 | std::string file_name = webrtc::test::ResourcePath( |
| 84 | "audio_coding/testfile32kHz", "pcm"); |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 85 | if (strlen(FLAG_input_file) > 0) |
| 86 | file_name = FLAG_input_file; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 87 | in_file_a_.Open(file_name, 32000, "rb"); |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 88 | ASSERT_EQ(0, acm_a_->InitializeReceiver()) << |
| 89 | "Couldn't initialize receiver.\n"; |
| 90 | ASSERT_EQ(0, acm_b_->InitializeReceiver()) << |
| 91 | "Couldn't initialize receiver.\n"; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 92 | |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 93 | if (FLAG_delay > 0) { |
| 94 | ASSERT_EQ(0, acm_b_->SetMinimumPlayoutDelay(FLAG_delay)) << |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 95 | "Failed to set minimum delay.\n"; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 96 | } |
| 97 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 98 | int num_encoders = acm_a_->NumberOfCodecs(); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 99 | CodecInst my_codec_param; |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 100 | for (int n = 0; n < num_encoders; n++) { |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 101 | EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param)) << |
| 102 | "Failed to get codec."; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 103 | if (STR_CASE_CMP(my_codec_param.plname, "opus") == 0) |
| 104 | my_codec_param.channels = 1; |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 105 | else if (my_codec_param.channels > 1) |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 106 | continue; |
| 107 | if (STR_CASE_CMP(my_codec_param.plname, "CN") == 0 && |
| 108 | my_codec_param.plfreq == 48000) |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 109 | continue; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 110 | if (STR_CASE_CMP(my_codec_param.plname, "telephone-event") == 0) |
| 111 | continue; |
kwiberg | da2bf4e | 2016-10-24 13:47:09 -0700 | [diff] [blame] | 112 | ASSERT_EQ(true, |
| 113 | acm_b_->RegisterReceiveCodec(my_codec_param.pltype, |
| 114 | CodecInstToSdp(my_codec_param))); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | // Create and connect the channel |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 118 | ASSERT_EQ(0, acm_a_->RegisterTransportCallback(channel_a2b_)) << |
| 119 | "Couldn't register Transport callback.\n"; |
andrew@webrtc.org | 89df092 | 2013-09-12 01:27:43 +0000 | [diff] [blame] | 120 | channel_a2b_->RegisterReceiverACM(acm_b_.get()); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 121 | } |
| 122 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 123 | void Perform(const TestSettings* config, size_t num_tests, int duration_sec, |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 124 | const char* output_prefix) { |
| 125 | for (size_t n = 0; n < num_tests; ++n) { |
| 126 | ApplyConfig(config[n]); |
| 127 | Run(duration_sec, output_prefix); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | private: |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 132 | void ApplyConfig(const TestSettings& config) { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 133 | printf("====================================\n"); |
| 134 | printf("Test %d \n" |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 135 | "Codec: %s, %d kHz, %d channel(s)\n" |
| 136 | "ACM: DTX %s, FEC %s\n" |
| 137 | "Channel: %s\n", |
| 138 | ++test_cntr_, config.codec.name, config.codec.sample_rate_hz, |
| 139 | config.codec.num_channels, config.acm.dtx ? "on" : "off", |
| 140 | config.acm.fec ? "on" : "off", |
| 141 | config.packet_loss ? "with packet-loss" : "no packet-loss"); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 142 | SendCodec(config.codec); |
| 143 | ConfigAcm(config.acm); |
| 144 | ConfigChannel(config.packet_loss); |
| 145 | } |
| 146 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 147 | void SendCodec(const CodecSettings& config) { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 148 | CodecInst my_codec_param; |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 149 | ASSERT_EQ(0, AudioCodingModule::Codec( |
| 150 | config.name, &my_codec_param, config.sample_rate_hz, |
| 151 | config.num_channels)) << "Specified codec is not supported.\n"; |
| 152 | |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 153 | encoding_sample_rate_hz_ = my_codec_param.plfreq; |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 154 | ASSERT_EQ(0, acm_a_->RegisterSendCodec(my_codec_param)) << |
| 155 | "Failed to register send-codec.\n"; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 156 | } |
| 157 | |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 158 | void ConfigAcm(const AcmSettings& config) { |
| 159 | ASSERT_EQ(0, acm_a_->SetVAD(config.dtx, config.dtx, VADAggr)) << |
| 160 | "Failed to set VAD.\n"; |
minyue@webrtc.org | aa5ea1c | 2014-05-23 15:16:51 +0000 | [diff] [blame] | 161 | ASSERT_EQ(0, acm_a_->SetREDStatus(config.fec)) << |
| 162 | "Failed to set RED.\n"; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | void ConfigChannel(bool packet_loss) { |
| 166 | channel_a2b_->SetFECTestWithPacketLoss(packet_loss); |
| 167 | } |
| 168 | |
| 169 | void OpenOutFile(const char* output_id) { |
| 170 | std::stringstream file_stream; |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 171 | file_stream << "delay_test_" << FLAG_codec << "_" << FLAG_sample_rate_hz |
| 172 | << "Hz" << "_" << FLAG_delay << "ms.pcm"; |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 173 | std::cout << "Output file: " << file_stream.str() << std::endl << std::endl; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 174 | std::string file_name = webrtc::test::OutputPath() + file_stream.str(); |
| 175 | out_file_b_.Open(file_name.c_str(), 32000, "wb"); |
| 176 | } |
| 177 | |
| 178 | void Run(int duration_sec, const char* output_prefix) { |
| 179 | OpenOutFile(output_prefix); |
| 180 | AudioFrame audio_frame; |
| 181 | uint32_t out_freq_hz_b = out_file_b_.SamplingFrequency(); |
| 182 | |
| 183 | int num_frames = 0; |
| 184 | int in_file_frames = 0; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 185 | uint32_t received_ts; |
| 186 | double average_delay = 0; |
| 187 | double inst_delay_sec = 0; |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 188 | while (num_frames < (duration_sec * 100)) { |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 189 | if (in_file_a_.EndOfFile()) { |
| 190 | in_file_a_.Rewind(); |
| 191 | } |
| 192 | |
| 193 | // Print delay information every 16 frame |
| 194 | if ((num_frames & 0x3F) == 0x3F) { |
minyue@webrtc.org | c0bd7be | 2015-02-18 15:24:13 +0000 | [diff] [blame] | 195 | NetworkStatistics statistics; |
| 196 | acm_b_->GetNetworkStatistics(&statistics); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 197 | fprintf(stdout, "delay: min=%3d max=%3d mean=%3d median=%3d" |
| 198 | " ts-based average = %6.3f, " |
| 199 | "curr buff-lev = %4u opt buff-lev = %4u \n", |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 200 | statistics.minWaitingTimeMs, statistics.maxWaitingTimeMs, |
| 201 | statistics.meanWaitingTimeMs, statistics.medianWaitingTimeMs, |
| 202 | average_delay, statistics.currentBufferSize, |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 203 | statistics.preferredBufferSize); |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 204 | fflush (stdout); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | in_file_a_.Read10MsData(audio_frame); |
henrik.lundin@webrtc.org | f56c162 | 2015-03-02 12:29:30 +0000 | [diff] [blame] | 208 | ASSERT_GE(acm_a_->Add10MsData(audio_frame), 0); |
henrik.lundin | d4ccb00 | 2016-05-17 12:21:55 -0700 | [diff] [blame] | 209 | bool muted; |
| 210 | ASSERT_EQ(0, |
| 211 | acm_b_->PlayoutData10Ms(out_freq_hz_b, &audio_frame, &muted)); |
| 212 | RTC_DCHECK(!muted); |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 213 | out_file_b_.Write10MsData( |
yujo | 36b1a5f | 2017-06-12 12:45:32 -0700 | [diff] [blame] | 214 | audio_frame.data(), |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 215 | audio_frame.samples_per_channel_ * audio_frame.num_channels_); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 216 | received_ts = channel_a2b_->LastInTimestamp(); |
henrik.lundin | 9a410dd | 2016-04-06 01:39:22 -0700 | [diff] [blame] | 217 | rtc::Optional<uint32_t> playout_timestamp = acm_b_->PlayoutTimestamp(); |
| 218 | ASSERT_TRUE(playout_timestamp); |
| 219 | inst_delay_sec = static_cast<uint32_t>(received_ts - *playout_timestamp) / |
| 220 | static_cast<double>(encoding_sample_rate_hz_); |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 221 | |
| 222 | if (num_frames > 10) |
| 223 | average_delay = 0.95 * average_delay + 0.05 * inst_delay_sec; |
| 224 | |
| 225 | ++num_frames; |
| 226 | ++in_file_frames; |
| 227 | } |
| 228 | out_file_b_.Close(); |
| 229 | } |
| 230 | |
kwiberg | 3747838 | 2016-02-14 20:40:57 -0800 | [diff] [blame] | 231 | std::unique_ptr<AudioCodingModule> acm_a_; |
| 232 | std::unique_ptr<AudioCodingModule> acm_b_; |
turaj@webrtc.org | 6388c3e | 2013-02-12 21:42:18 +0000 | [diff] [blame] | 233 | |
| 234 | Channel* channel_a2b_; |
| 235 | |
| 236 | PCMFile in_file_a_; |
| 237 | PCMFile out_file_b_; |
| 238 | int test_cntr_; |
| 239 | int encoding_sample_rate_hz_; |
| 240 | }; |
| 241 | |
andresp@webrtc.org | 185bae4 | 2013-05-14 08:02:25 +0000 | [diff] [blame] | 242 | } // namespace webrtc |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 243 | |
| 244 | int main(int argc, char* argv[]) { |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 245 | if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) { |
| 246 | return 1; |
| 247 | } |
| 248 | if (FLAG_help) { |
| 249 | rtc::FlagList::Print(nullptr, false); |
| 250 | return 0; |
| 251 | } |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 252 | |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 253 | webrtc::TestSettings test_setting; |
| 254 | strcpy(test_setting.codec.name, FLAG_codec); |
| 255 | |
| 256 | if (FLAG_sample_rate_hz != 8000 && |
| 257 | FLAG_sample_rate_hz != 16000 && |
| 258 | FLAG_sample_rate_hz != 32000 && |
| 259 | FLAG_sample_rate_hz != 48000) { |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 260 | std::cout << "Invalid sampling rate.\n"; |
| 261 | return 1; |
| 262 | } |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 263 | test_setting.codec.sample_rate_hz = FLAG_sample_rate_hz; |
| 264 | if (FLAG_num_channels < 1 || FLAG_num_channels > 2) { |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 265 | std::cout << "Only mono and stereo are supported.\n"; |
| 266 | return 1; |
| 267 | } |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 268 | test_setting.codec.num_channels = FLAG_num_channels; |
| 269 | test_setting.acm.dtx = FLAG_dtx; |
| 270 | test_setting.acm.fec = FLAG_fec; |
| 271 | test_setting.packet_loss = FLAG_packet_loss; |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 272 | |
henrik.lundin@webrtc.org | adaf809 | 2014-04-17 08:29:10 +0000 | [diff] [blame] | 273 | webrtc::DelayTest delay_test; |
turaj@webrtc.org | 7a05ae5 | 2013-11-18 18:16:53 +0000 | [diff] [blame] | 274 | delay_test.Initialize(); |
| 275 | delay_test.Perform(&test_setting, 1, 240, "delay_test"); |
| 276 | return 0; |
| 277 | } |