| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 26 matching lines...) Expand all Loading... |
| 37 std::string GetIndexedOutputWavFilename(const std::string& wav_name, | 37 std::string GetIndexedOutputWavFilename(const std::string& wav_name, |
| 38 int counter) { | 38 int counter) { |
| 39 std::stringstream ss; | 39 std::stringstream ss; |
| 40 ss << wav_name.substr(0, wav_name.size() - 4) << "_" << counter | 40 ss << wav_name.substr(0, wav_name.size() - 4) << "_" << counter |
| 41 << wav_name.substr(wav_name.size() - 4); | 41 << wav_name.substr(wav_name.size() - 4); |
| 42 return ss.str(); | 42 return ss.str(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 SimulationSettings::SimulationSettings() = default; |
| 48 SimulationSettings::SimulationSettings(const SimulationSettings&) = default; |
| 49 SimulationSettings::~SimulationSettings() = default; |
| 50 |
| 47 void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest) { | 51 void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest) { |
| 48 RTC_CHECK_EQ(src.num_channels(), dest->num_channels_); | 52 RTC_CHECK_EQ(src.num_channels(), dest->num_channels_); |
| 49 RTC_CHECK_EQ(src.num_frames(), dest->samples_per_channel_); | 53 RTC_CHECK_EQ(src.num_frames(), dest->samples_per_channel_); |
| 50 for (size_t ch = 0; ch < dest->num_channels_; ++ch) { | 54 for (size_t ch = 0; ch < dest->num_channels_; ++ch) { |
| 51 for (size_t sample = 0; sample < dest->samples_per_channel_; ++sample) { | 55 for (size_t sample = 0; sample < dest->samples_per_channel_; ++sample) { |
| 52 dest->data_[sample * dest->num_channels_ + ch] = | 56 dest->data_[sample * dest->num_channels_ + ch] = |
| 53 src.channels()[ch][sample] * 32767; | 57 src.channels()[ch][sample] * 32767; |
| 54 } | 58 } |
| 55 } | 59 } |
| 56 } | 60 } |
| 57 | 61 |
| 62 AudioProcessingSimulator::AudioProcessingSimulator( |
| 63 const SimulationSettings& settings) |
| 64 : settings_(settings) {} |
| 65 |
| 66 AudioProcessingSimulator::~AudioProcessingSimulator() = default; |
| 67 |
| 58 AudioProcessingSimulator::ScopedTimer::~ScopedTimer() { | 68 AudioProcessingSimulator::ScopedTimer::~ScopedTimer() { |
| 59 int64_t interval = rtc::TimeNanos() - start_time_; | 69 int64_t interval = rtc::TimeNanos() - start_time_; |
| 60 proc_time_->sum += interval; | 70 proc_time_->sum += interval; |
| 61 proc_time_->max = std::max(proc_time_->max, interval); | 71 proc_time_->max = std::max(proc_time_->max, interval); |
| 62 proc_time_->min = std::min(proc_time_->min, interval); | 72 proc_time_->min = std::min(proc_time_->min, interval); |
| 63 } | 73 } |
| 64 | 74 |
| 65 void AudioProcessingSimulator::ProcessStream(bool fixed_interface) { | 75 void AudioProcessingSimulator::ProcessStream(bool fixed_interface) { |
| 66 if (fixed_interface) { | 76 if (fixed_interface) { |
| 67 { | 77 { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize; | 339 size_t kMaxFilenameSize = AudioProcessing::kMaxFilenameSize; |
| 330 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize); | 340 RTC_CHECK_LE(settings_.aec_dump_output_filename->size(), kMaxFilenameSize); |
| 331 RTC_CHECK_EQ(AudioProcessing::kNoError, | 341 RTC_CHECK_EQ(AudioProcessing::kNoError, |
| 332 ap_->StartDebugRecording( | 342 ap_->StartDebugRecording( |
| 333 settings_.aec_dump_output_filename->c_str(), -1)); | 343 settings_.aec_dump_output_filename->c_str(), -1)); |
| 334 } | 344 } |
| 335 } | 345 } |
| 336 | 346 |
| 337 } // namespace test | 347 } // namespace test |
| 338 } // namespace webrtc | 348 } // namespace webrtc |
| OLD | NEW |