| 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 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 max_payload_bytes_(0), | 225 max_payload_bytes_(0), |
| 226 in_file_(new ResampleInputAudioFile(FLAGS_in_filename, | 226 in_file_(new ResampleInputAudioFile(FLAGS_in_filename, |
| 227 FLAGS_input_sample_rate, | 227 FLAGS_input_sample_rate, |
| 228 in_sampling_khz * 1000)), | 228 in_sampling_khz * 1000)), |
| 229 rtp_generator_( | 229 rtp_generator_( |
| 230 new RtpGenerator(in_sampling_khz_, 0, 0, decodable_time_ms_)), | 230 new RtpGenerator(in_sampling_khz_, 0, 0, decodable_time_ms_)), |
| 231 total_payload_size_bytes_(0) { | 231 total_payload_size_bytes_(0) { |
| 232 const std::string out_filename = FLAGS_out_filename; | 232 const std::string out_filename = FLAGS_out_filename; |
| 233 const std::string log_filename = out_filename + ".log"; | 233 const std::string log_filename = out_filename + ".log"; |
| 234 log_file_.open(log_filename.c_str(), std::ofstream::out); | 234 log_file_.open(log_filename.c_str(), std::ofstream::out); |
| 235 CHECK(log_file_.is_open()); | 235 RTC_CHECK(log_file_.is_open()); |
| 236 | 236 |
| 237 if (out_filename.size() >= 4 && | 237 if (out_filename.size() >= 4 && |
| 238 out_filename.substr(out_filename.size() - 4) == ".wav") { | 238 out_filename.substr(out_filename.size() - 4) == ".wav") { |
| 239 // Open a wav file. | 239 // Open a wav file. |
| 240 output_.reset( | 240 output_.reset( |
| 241 new webrtc::test::OutputWavFile(out_filename, 1000 * out_sampling_khz)); | 241 new webrtc::test::OutputWavFile(out_filename, 1000 * out_sampling_khz)); |
| 242 } else { | 242 } else { |
| 243 // Open a pcm file. | 243 // Open a pcm file. |
| 244 output_.reset(new webrtc::test::OutputAudioFile(out_filename)); | 244 output_.reset(new webrtc::test::OutputAudioFile(out_filename)); |
| 245 } | 245 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 int channels; | 395 int channels; |
| 396 size_t samples; | 396 size_t samples; |
| 397 int ret = neteq_->GetAudio(out_size_samples_ * channels_, &out_data_[0], | 397 int ret = neteq_->GetAudio(out_size_samples_ * channels_, &out_data_[0], |
| 398 &samples, &channels, NULL); | 398 &samples, &channels, NULL); |
| 399 | 399 |
| 400 if (ret != NetEq::kOK) { | 400 if (ret != NetEq::kOK) { |
| 401 return -1; | 401 return -1; |
| 402 } else { | 402 } else { |
| 403 assert(channels == channels_); | 403 assert(channels == channels_); |
| 404 assert(samples == static_cast<size_t>(kOutputSizeMs * out_sampling_khz_)); | 404 assert(samples == static_cast<size_t>(kOutputSizeMs * out_sampling_khz_)); |
| 405 CHECK(output_->WriteArray(out_data_.get(), samples * channels)); | 405 RTC_CHECK(output_->WriteArray(out_data_.get(), samples * channels)); |
| 406 return static_cast<int>(samples); | 406 return static_cast<int>(samples); |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 | 409 |
| 410 void NetEqQualityTest::Simulate() { | 410 void NetEqQualityTest::Simulate() { |
| 411 int audio_size_samples; | 411 int audio_size_samples; |
| 412 | 412 |
| 413 while (decoded_time_ms_ < FLAGS_runtime_ms) { | 413 while (decoded_time_ms_ < FLAGS_runtime_ms) { |
| 414 // Assume 10 packets in packets buffer. | 414 // Assume 10 packets in packets buffer. |
| 415 while (decodable_time_ms_ - 10 * block_duration_ms_ < decoded_time_ms_) { | 415 while (decodable_time_ms_ - 10 * block_duration_ms_ < decoded_time_ms_) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 Log() << "Average bit rate was " | 428 Log() << "Average bit rate was " |
| 429 << 8.0f * total_payload_size_bytes_ / FLAGS_runtime_ms | 429 << 8.0f * total_payload_size_bytes_ / FLAGS_runtime_ms |
| 430 << " kbps" | 430 << " kbps" |
| 431 << std::endl; | 431 << std::endl; |
| 432 } | 432 } |
| 433 | 433 |
| 434 } // namespace test | 434 } // namespace test |
| 435 } // namespace webrtc | 435 } // namespace webrtc |
| OLD | NEW |