OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
11 #include <math.h> | 11 #include <math.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 | 13 |
14 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 14 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
15 #include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h" | 15 #include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h" |
16 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" | 16 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" |
17 #include "webrtc/modules/audio_coding/neteq/tools/output_wav_file.h" | 17 #include "webrtc/modules/audio_coding/neteq/tools/output_wav_file.h" |
18 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" | 18 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" |
19 #include "webrtc/rtc_base/checks.h" | 19 #include "webrtc/rtc_base/checks.h" |
20 #include "webrtc/test/testsupport/fileutils.h" | 20 #include "webrtc/test/testsupport/fileutils.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 namespace test { | 23 namespace test { |
24 | 24 |
25 const uint8_t kPayloadType = 95; | 25 const uint8_t kPayloadType = 95; |
26 const int kOutputSizeMs = 10; | 26 const int kOutputSizeMs = 10; |
27 const int kInitSeed = 0x12345678; | 27 const int kInitSeed = 0x12345678; |
28 const int kPacketLossTimeUnitMs = 10; | 28 const int kPacketLossTimeUnitMs = 10; |
29 | 29 |
| 30 const std::string& DefaultInFilename() { |
| 31 static const std::string path = |
| 32 ResourcePath("audio_coding/speech_mono_16kHz", "pcm"); |
| 33 return path; |
| 34 } |
| 35 |
| 36 const std::string& DefaultOutFilename() { |
| 37 static const std::string path = OutputPath() + "neteq_quality_test_out.pcm"; |
| 38 return path; |
| 39 } |
| 40 |
30 // Common validator for file names. | 41 // Common validator for file names. |
31 static bool ValidateFilename(const std::string& value, bool write) { | 42 static bool ValidateFilename(const std::string& value, bool write) { |
32 FILE* fid = write ? fopen(value.c_str(), "wb") : fopen(value.c_str(), "rb"); | 43 FILE* fid = write ? fopen(value.c_str(), "wb") : fopen(value.c_str(), "rb"); |
33 if (fid == nullptr) | 44 if (fid == nullptr) |
34 return false; | 45 return false; |
35 fclose(fid); | 46 fclose(fid); |
36 return true; | 47 return true; |
37 } | 48 } |
38 | 49 |
39 // Define switch for input file name. | 50 DEFINE_string(in_filename, DefaultInFilename().c_str(), |
40 static bool ValidateInFilename(const char* flagname, const std::string& value) { | 51 "Filename for input audio (specify sample rate with --input_sample_rate, " |
41 if (!ValidateFilename(value, false)) { | |
42 printf("Invalid input filename."); | |
43 return false; | |
44 } | |
45 return true; | |
46 } | |
47 | |
48 DEFINE_string( | |
49 in_filename, | |
50 ResourcePath("audio_coding/speech_mono_16kHz", "pcm"), | |
51 "Filename for input audio (specify sample rate with --input_sample_rate ," | |
52 "and channels with --channels)."); | 52 "and channels with --channels)."); |
53 | 53 |
54 static const bool in_filename_dummy = | 54 DEFINE_int(input_sample_rate, 16000, "Sample rate of input file in Hz."); |
55 RegisterFlagValidator(&FLAGS_in_filename, &ValidateInFilename); | |
56 | 55 |
57 // Define switch for sample rate. | 56 DEFINE_int(channels, 1, "Number of channels in input audio."); |
58 static bool ValidateSampleRate(const char* flagname, int32_t value) { | |
59 if (value == 8000 || value == 16000 || value == 32000 || value == 48000) | |
60 return true; | |
61 printf("Invalid sample rate should be 8000, 16000, 32000 or 48000 Hz."); | |
62 return false; | |
63 } | |
64 | 57 |
65 DEFINE_int32(input_sample_rate, 16000, "Sample rate of input file in Hz."); | 58 DEFINE_string(out_filename, DefaultOutFilename().c_str(), |
| 59 "Name of output audio file."); |
66 | 60 |
67 static const bool sample_rate_dummy = | 61 DEFINE_int(runtime_ms, 10000, "Simulated runtime (milliseconds)."); |
68 RegisterFlagValidator(&FLAGS_input_sample_rate, &ValidateSampleRate); | |
69 | 62 |
70 // Define switch for channels. | 63 DEFINE_int(packet_loss_rate, 10, "Percentile of packet loss."); |
71 static bool ValidateChannels(const char* flagname, int32_t value) { | |
72 if (value == 1) | |
73 return true; | |
74 printf("Invalid number of channels, current support only 1."); | |
75 return false; | |
76 } | |
77 | 64 |
78 DEFINE_int32(channels, 1, "Number of channels in input audio."); | 65 DEFINE_int(random_loss_mode, 1, |
| 66 "Random loss mode: 0--no loss, 1--uniform loss, 2--Gilbert Elliot loss."); |
79 | 67 |
80 static const bool channels_dummy = | 68 DEFINE_int(burst_length, 30, |
81 RegisterFlagValidator(&FLAGS_channels, &ValidateChannels); | |
82 | |
83 // Define switch for output file name. | |
84 static bool ValidateOutFilename(const char* flagname, | |
85 const std::string& value) { | |
86 if (!ValidateFilename(value, true)) { | |
87 printf("Invalid output filename."); | |
88 return false; | |
89 } | |
90 return true; | |
91 } | |
92 | |
93 DEFINE_string(out_filename, | |
94 OutputPath() + "neteq_quality_test_out.pcm", | |
95 "Name of output audio file."); | |
96 | |
97 static const bool out_filename_dummy = | |
98 RegisterFlagValidator(&FLAGS_out_filename, &ValidateOutFilename); | |
99 | |
100 // Define switch for packet loss rate. | |
101 static bool ValidatePacketLossRate(const char* /* flag_name */, int32_t value) { | |
102 if (value >= 0 && value <= 100) | |
103 return true; | |
104 printf("Invalid packet loss percentile, should be between 0 and 100."); | |
105 return false; | |
106 } | |
107 | |
108 // Define switch for runtime. | |
109 static bool ValidateRuntime(const char* flagname, int32_t value) { | |
110 if (value > 0) | |
111 return true; | |
112 printf("Invalid runtime, should be greater than 0."); | |
113 return false; | |
114 } | |
115 | |
116 DEFINE_int32(runtime_ms, 10000, "Simulated runtime (milliseconds)."); | |
117 | |
118 static const bool runtime_dummy = | |
119 RegisterFlagValidator(&FLAGS_runtime_ms, &ValidateRuntime); | |
120 | |
121 DEFINE_int32(packet_loss_rate, 10, "Percentile of packet loss."); | |
122 | |
123 static const bool packet_loss_rate_dummy = | |
124 RegisterFlagValidator(&FLAGS_packet_loss_rate, &ValidatePacketLossRate); | |
125 | |
126 // Define switch for random loss mode. | |
127 static bool ValidateRandomLossMode(const char* /* flag_name */, int32_t value) { | |
128 if (value >= 0 && value <= 2) | |
129 return true; | |
130 printf("Invalid random packet loss mode, should be between 0 and 2."); | |
131 return false; | |
132 } | |
133 | |
134 DEFINE_int32(random_loss_mode, 1, | |
135 "Random loss mode: 0--no loss, 1--uniform loss, 2--Gilbert Elliot loss."); | |
136 static const bool random_loss_mode_dummy = | |
137 RegisterFlagValidator(&FLAGS_random_loss_mode, &ValidateRandomLossMode); | |
138 | |
139 // Define switch for burst length. | |
140 static bool ValidateBurstLength(const char* /* flag_name */, int32_t value) { | |
141 if (value >= kPacketLossTimeUnitMs) | |
142 return true; | |
143 printf("Invalid burst length, should be greater than %d ms.", | |
144 kPacketLossTimeUnitMs); | |
145 return false; | |
146 } | |
147 | |
148 DEFINE_int32(burst_length, 30, | |
149 "Burst length in milliseconds, only valid for Gilbert Elliot loss."); | 69 "Burst length in milliseconds, only valid for Gilbert Elliot loss."); |
150 | 70 |
151 static const bool burst_length_dummy = | 71 DEFINE_float(drift_factor, 0.0, "Time drift factor."); |
152 RegisterFlagValidator(&FLAGS_burst_length, &ValidateBurstLength); | |
153 | |
154 // Define switch for drift factor. | |
155 static bool ValidateDriftFactor(const char* /* flag_name */, double value) { | |
156 if (value > -0.1) | |
157 return true; | |
158 printf("Invalid drift factor, should be greater than -0.1."); | |
159 return false; | |
160 } | |
161 | |
162 DEFINE_double(drift_factor, 0.0, "Time drift factor."); | |
163 | |
164 static const bool drift_factor_dummy = | |
165 RegisterFlagValidator(&FLAGS_drift_factor, &ValidateDriftFactor); | |
166 | 72 |
167 // ProbTrans00Solver() is to calculate the transition probability from no-loss | 73 // ProbTrans00Solver() is to calculate the transition probability from no-loss |
168 // state to itself in a modified Gilbert Elliot packet loss model. The result is | 74 // state to itself in a modified Gilbert Elliot packet loss model. The result is |
169 // to achieve the target packet loss rate |loss_rate|, when a packet is not | 75 // to achieve the target packet loss rate |loss_rate|, when a packet is not |
170 // lost only if all |units| drawings within the duration of the packet result in | 76 // lost only if all |units| drawings within the duration of the packet result in |
171 // no-loss. | 77 // no-loss. |
172 static double ProbTrans00Solver(int units, double loss_rate, | 78 static double ProbTrans00Solver(int units, double loss_rate, |
173 double prob_trans_10) { | 79 double prob_trans_10) { |
174 if (units == 1) | 80 if (units == 1) |
175 return prob_trans_10 / (1.0f - loss_rate) - prob_trans_10; | 81 return prob_trans_10 / (1.0f - loss_rate) - prob_trans_10; |
(...skipping 28 matching lines...) Expand all Loading... |
204 iter ++; | 110 iter ++; |
205 } | 111 } |
206 return x; | 112 return x; |
207 } | 113 } |
208 | 114 |
209 NetEqQualityTest::NetEqQualityTest(int block_duration_ms, | 115 NetEqQualityTest::NetEqQualityTest(int block_duration_ms, |
210 int in_sampling_khz, | 116 int in_sampling_khz, |
211 int out_sampling_khz, | 117 int out_sampling_khz, |
212 NetEqDecoder decoder_type) | 118 NetEqDecoder decoder_type) |
213 : decoder_type_(decoder_type), | 119 : decoder_type_(decoder_type), |
214 channels_(static_cast<size_t>(FLAGS_channels)), | 120 channels_(static_cast<size_t>(FLAG_channels)), |
215 decoded_time_ms_(0), | 121 decoded_time_ms_(0), |
216 decodable_time_ms_(0), | 122 decodable_time_ms_(0), |
217 drift_factor_(FLAGS_drift_factor), | 123 drift_factor_(FLAG_drift_factor), |
218 packet_loss_rate_(FLAGS_packet_loss_rate), | 124 packet_loss_rate_(FLAG_packet_loss_rate), |
219 block_duration_ms_(block_duration_ms), | 125 block_duration_ms_(block_duration_ms), |
220 in_sampling_khz_(in_sampling_khz), | 126 in_sampling_khz_(in_sampling_khz), |
221 out_sampling_khz_(out_sampling_khz), | 127 out_sampling_khz_(out_sampling_khz), |
222 in_size_samples_( | 128 in_size_samples_( |
223 static_cast<size_t>(in_sampling_khz_ * block_duration_ms_)), | 129 static_cast<size_t>(in_sampling_khz_ * block_duration_ms_)), |
224 payload_size_bytes_(0), | 130 payload_size_bytes_(0), |
225 max_payload_bytes_(0), | 131 max_payload_bytes_(0), |
226 in_file_(new ResampleInputAudioFile(FLAGS_in_filename, | 132 in_file_(new ResampleInputAudioFile(FLAG_in_filename, |
227 FLAGS_input_sample_rate, | 133 FLAG_input_sample_rate, |
228 in_sampling_khz * 1000)), | 134 in_sampling_khz * 1000)), |
229 rtp_generator_( | 135 rtp_generator_( |
230 new RtpGenerator(in_sampling_khz_, 0, 0, decodable_time_ms_)), | 136 new RtpGenerator(in_sampling_khz_, 0, 0, decodable_time_ms_)), |
231 total_payload_size_bytes_(0) { | 137 total_payload_size_bytes_(0) { |
232 const std::string out_filename = FLAGS_out_filename; | 138 // Flag validation |
| 139 RTC_CHECK(ValidateFilename(FLAG_in_filename, false)) |
| 140 << "Invalid input filename."; |
| 141 |
| 142 RTC_CHECK(FLAG_input_sample_rate == 8000 || FLAG_input_sample_rate == 16000 || |
| 143 FLAG_input_sample_rate == 32000 || FLAG_input_sample_rate == 48000) |
| 144 << "Invalid sample rate should be 8000, 16000, 32000 or 48000 Hz."; |
| 145 |
| 146 RTC_CHECK_EQ(FLAG_channels, 1) |
| 147 << "Invalid number of channels, current support only 1."; |
| 148 |
| 149 RTC_CHECK(ValidateFilename(FLAG_out_filename, true)) |
| 150 << "Invalid output filename."; |
| 151 |
| 152 RTC_CHECK_GT(FLAG_runtime_ms, 0) |
| 153 << "Invalid runtime, should be greater than 0."; |
| 154 |
| 155 RTC_CHECK(FLAG_packet_loss_rate >= 0 && FLAG_packet_loss_rate <= 100) |
| 156 << "Invalid packet loss percentile, should be between 0 and 100."; |
| 157 |
| 158 RTC_CHECK(FLAG_random_loss_mode >= 0 && FLAG_random_loss_mode <= 2) |
| 159 << "Invalid random packet loss mode, should be between 0 and 2."; |
| 160 |
| 161 RTC_CHECK_GE(FLAG_burst_length, kPacketLossTimeUnitMs) |
| 162 << "Invalid burst length, should be greater than or equal to " |
| 163 << kPacketLossTimeUnitMs << " ms."; |
| 164 |
| 165 RTC_CHECK_GT(FLAG_drift_factor, -0.1) |
| 166 << "Invalid drift factor, should be greater than -0.1."; |
| 167 |
| 168 const std::string out_filename = FLAG_out_filename; |
233 const std::string log_filename = out_filename + ".log"; | 169 const std::string log_filename = out_filename + ".log"; |
234 log_file_.open(log_filename.c_str(), std::ofstream::out); | 170 log_file_.open(log_filename.c_str(), std::ofstream::out); |
235 RTC_CHECK(log_file_.is_open()); | 171 RTC_CHECK(log_file_.is_open()); |
236 | 172 |
237 if (out_filename.size() >= 4 && | 173 if (out_filename.size() >= 4 && |
238 out_filename.substr(out_filename.size() - 4) == ".wav") { | 174 out_filename.substr(out_filename.size() - 4) == ".wav") { |
239 // Open a wav file. | 175 // Open a wav file. |
240 output_.reset( | 176 output_.reset( |
241 new webrtc::test::OutputWavFile(out_filename, 1000 * out_sampling_khz)); | 177 new webrtc::test::OutputWavFile(out_filename, 1000 * out_sampling_khz)); |
242 } else { | 178 } else { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 return lost_last_ = uniform_loss_model_->Lost(); | 227 return lost_last_ = uniform_loss_model_->Lost(); |
292 } | 228 } |
293 } | 229 } |
294 | 230 |
295 void NetEqQualityTest::SetUp() { | 231 void NetEqQualityTest::SetUp() { |
296 ASSERT_EQ(0, | 232 ASSERT_EQ(0, |
297 neteq_->RegisterPayloadType(decoder_type_, "noname", kPayloadType)); | 233 neteq_->RegisterPayloadType(decoder_type_, "noname", kPayloadType)); |
298 rtp_generator_->set_drift_factor(drift_factor_); | 234 rtp_generator_->set_drift_factor(drift_factor_); |
299 | 235 |
300 int units = block_duration_ms_ / kPacketLossTimeUnitMs; | 236 int units = block_duration_ms_ / kPacketLossTimeUnitMs; |
301 switch (FLAGS_random_loss_mode) { | 237 switch (FLAG_random_loss_mode) { |
302 case 1: { | 238 case 1: { |
303 // |unit_loss_rate| is the packet loss rate for each unit time interval | 239 // |unit_loss_rate| is the packet loss rate for each unit time interval |
304 // (kPacketLossTimeUnitMs). Since a packet loss event is generated if any | 240 // (kPacketLossTimeUnitMs). Since a packet loss event is generated if any |
305 // of |block_duration_ms_ / kPacketLossTimeUnitMs| unit time intervals of | 241 // of |block_duration_ms_ / kPacketLossTimeUnitMs| unit time intervals of |
306 // a full packet duration is drawn with a loss, |unit_loss_rate| fulfills | 242 // a full packet duration is drawn with a loss, |unit_loss_rate| fulfills |
307 // (1 - unit_loss_rate) ^ (block_duration_ms_ / kPacketLossTimeUnitMs) == | 243 // (1 - unit_loss_rate) ^ (block_duration_ms_ / kPacketLossTimeUnitMs) == |
308 // 1 - packet_loss_rate. | 244 // 1 - packet_loss_rate. |
309 double unit_loss_rate = (1.0f - pow(1.0f - 0.01f * packet_loss_rate_, | 245 double unit_loss_rate = (1.0f - pow(1.0f - 0.01f * packet_loss_rate_, |
310 1.0f / units)); | 246 1.0f / units)); |
311 loss_model_.reset(new UniformLoss(unit_loss_rate)); | 247 loss_model_.reset(new UniformLoss(unit_loss_rate)); |
312 break; | 248 break; |
313 } | 249 } |
314 case 2: { | 250 case 2: { |
315 // |FLAGS_burst_length| should be integer times of kPacketLossTimeUnitMs. | 251 // |FLAG_burst_length| should be integer times of kPacketLossTimeUnitMs. |
316 ASSERT_EQ(0, FLAGS_burst_length % kPacketLossTimeUnitMs); | 252 ASSERT_EQ(0, FLAG_burst_length % kPacketLossTimeUnitMs); |
317 | 253 |
318 // We do not allow 100 percent packet loss in Gilbert Elliot model, which | 254 // We do not allow 100 percent packet loss in Gilbert Elliot model, which |
319 // makes no sense. | 255 // makes no sense. |
320 ASSERT_GT(100, packet_loss_rate_); | 256 ASSERT_GT(100, packet_loss_rate_); |
321 | 257 |
322 // To guarantee the overall packet loss rate, transition probabilities | 258 // To guarantee the overall packet loss rate, transition probabilities |
323 // need to satisfy: | 259 // need to satisfy: |
324 // pi_0 * (1 - prob_trans_01_) ^ units + | 260 // pi_0 * (1 - prob_trans_01_) ^ units + |
325 // pi_1 * prob_trans_10_ ^ (units - 1) == 1 - loss_rate | 261 // pi_1 * prob_trans_10_ ^ (units - 1) == 1 - loss_rate |
326 // pi_0 = prob_trans_10 / (prob_trans_10 + prob_trans_01_) | 262 // pi_0 = prob_trans_10 / (prob_trans_10 + prob_trans_01_) |
327 // is the stationary state probability of no-loss | 263 // is the stationary state probability of no-loss |
328 // pi_1 = prob_trans_01_ / (prob_trans_10 + prob_trans_01_) | 264 // pi_1 = prob_trans_01_ / (prob_trans_10 + prob_trans_01_) |
329 // is the stationary state probability of loss | 265 // is the stationary state probability of loss |
330 // After a derivation prob_trans_00 should satisfy: | 266 // After a derivation prob_trans_00 should satisfy: |
331 // prob_trans_00 ^ (units - 1) = (loss_rate - 1) / prob_trans_10 * | 267 // prob_trans_00 ^ (units - 1) = (loss_rate - 1) / prob_trans_10 * |
332 // prob_trans_00 + (1 - loss_rate) * (1 + 1 / prob_trans_10). | 268 // prob_trans_00 + (1 - loss_rate) * (1 + 1 / prob_trans_10). |
333 double loss_rate = 0.01f * packet_loss_rate_; | 269 double loss_rate = 0.01f * packet_loss_rate_; |
334 double prob_trans_10 = 1.0f * kPacketLossTimeUnitMs / FLAGS_burst_length; | 270 double prob_trans_10 = 1.0f * kPacketLossTimeUnitMs / FLAG_burst_length; |
335 double prob_trans_00 = ProbTrans00Solver(units, loss_rate, prob_trans_10); | 271 double prob_trans_00 = ProbTrans00Solver(units, loss_rate, prob_trans_10); |
336 loss_model_.reset(new GilbertElliotLoss(1.0f - prob_trans_10, | 272 loss_model_.reset(new GilbertElliotLoss(1.0f - prob_trans_10, |
337 1.0f - prob_trans_00)); | 273 1.0f - prob_trans_00)); |
338 break; | 274 break; |
339 } | 275 } |
340 default: { | 276 default: { |
341 loss_model_.reset(new NoLoss); | 277 loss_model_.reset(new NoLoss); |
342 break; | 278 break; |
343 } | 279 } |
344 } | 280 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 RTC_CHECK(output_->WriteArray( | 344 RTC_CHECK(output_->WriteArray( |
409 out_frame_.data(), | 345 out_frame_.data(), |
410 out_frame_.samples_per_channel_ * out_frame_.num_channels_)); | 346 out_frame_.samples_per_channel_ * out_frame_.num_channels_)); |
411 return static_cast<int>(out_frame_.samples_per_channel_); | 347 return static_cast<int>(out_frame_.samples_per_channel_); |
412 } | 348 } |
413 } | 349 } |
414 | 350 |
415 void NetEqQualityTest::Simulate() { | 351 void NetEqQualityTest::Simulate() { |
416 int audio_size_samples; | 352 int audio_size_samples; |
417 | 353 |
418 while (decoded_time_ms_ < FLAGS_runtime_ms) { | 354 while (decoded_time_ms_ < FLAG_runtime_ms) { |
419 // Assume 10 packets in packets buffer. | 355 // Assume 10 packets in packets buffer. |
420 while (decodable_time_ms_ - 10 * block_duration_ms_ < decoded_time_ms_) { | 356 while (decodable_time_ms_ - 10 * block_duration_ms_ < decoded_time_ms_) { |
421 ASSERT_TRUE(in_file_->Read(in_size_samples_ * channels_, &in_data_[0])); | 357 ASSERT_TRUE(in_file_->Read(in_size_samples_ * channels_, &in_data_[0])); |
422 payload_.Clear(); | 358 payload_.Clear(); |
423 payload_size_bytes_ = EncodeBlock(&in_data_[0], | 359 payload_size_bytes_ = EncodeBlock(&in_data_[0], |
424 in_size_samples_, &payload_, | 360 in_size_samples_, &payload_, |
425 max_payload_bytes_); | 361 max_payload_bytes_); |
426 total_payload_size_bytes_ += payload_size_bytes_; | 362 total_payload_size_bytes_ += payload_size_bytes_; |
427 decodable_time_ms_ = Transmit() + block_duration_ms_; | 363 decodable_time_ms_ = Transmit() + block_duration_ms_; |
428 } | 364 } |
429 audio_size_samples = DecodeBlock(); | 365 audio_size_samples = DecodeBlock(); |
430 if (audio_size_samples > 0) { | 366 if (audio_size_samples > 0) { |
431 decoded_time_ms_ += audio_size_samples / out_sampling_khz_; | 367 decoded_time_ms_ += audio_size_samples / out_sampling_khz_; |
432 } | 368 } |
433 } | 369 } |
434 Log() << "Average bit rate was " | 370 Log() << "Average bit rate was " |
435 << 8.0f * total_payload_size_bytes_ / FLAGS_runtime_ms | 371 << 8.0f * total_payload_size_bytes_ / FLAG_runtime_ms |
436 << " kbps" | 372 << " kbps" |
437 << std::endl; | 373 << std::endl; |
438 } | 374 } |
439 | 375 |
440 } // namespace test | 376 } // namespace test |
441 } // namespace webrtc | 377 } // namespace webrtc |
OLD | NEW |