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 10 matching lines...) Expand all Loading... |
21 #include "webrtc/base/optional.h" | 21 #include "webrtc/base/optional.h" |
22 #include "webrtc/common_audio/channel_buffer.h" | 22 #include "webrtc/common_audio/channel_buffer.h" |
23 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 23 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
24 #include "webrtc/modules/audio_processing/test/test_utils.h" | 24 #include "webrtc/modules/audio_processing/test/test_utils.h" |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 namespace test { | 27 namespace test { |
28 | 28 |
29 // Holds all the parameters available for controlling the simulation. | 29 // Holds all the parameters available for controlling the simulation. |
30 struct SimulationSettings { | 30 struct SimulationSettings { |
| 31 SimulationSettings(); |
| 32 SimulationSettings(const SimulationSettings&); |
| 33 ~SimulationSettings(); |
31 rtc::Optional<int> stream_delay; | 34 rtc::Optional<int> stream_delay; |
32 rtc::Optional<int> stream_drift_samples; | 35 rtc::Optional<int> stream_drift_samples; |
33 rtc::Optional<int> output_sample_rate_hz; | 36 rtc::Optional<int> output_sample_rate_hz; |
34 rtc::Optional<int> output_num_channels; | 37 rtc::Optional<int> output_num_channels; |
35 rtc::Optional<int> reverse_output_sample_rate_hz; | 38 rtc::Optional<int> reverse_output_sample_rate_hz; |
36 rtc::Optional<int> reverse_output_num_channels; | 39 rtc::Optional<int> reverse_output_num_channels; |
37 rtc::Optional<std::string> microphone_positions; | 40 rtc::Optional<std::string> microphone_positions; |
38 int target_angle_degrees = 90; | 41 int target_angle_degrees = 90; |
39 rtc::Optional<std::string> output_filename; | 42 rtc::Optional<std::string> output_filename; |
40 rtc::Optional<std::string> reverse_output_filename; | 43 rtc::Optional<std::string> reverse_output_filename; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 }; | 88 }; |
86 | 89 |
87 // Copies samples present in a ChannelBuffer into an AudioFrame. | 90 // Copies samples present in a ChannelBuffer into an AudioFrame. |
88 void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest); | 91 void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest); |
89 | 92 |
90 // Provides common functionality for performing audioprocessing simulations. | 93 // Provides common functionality for performing audioprocessing simulations. |
91 class AudioProcessingSimulator { | 94 class AudioProcessingSimulator { |
92 public: | 95 public: |
93 static const int kChunksPerSecond = 1000 / AudioProcessing::kChunkSizeMs; | 96 static const int kChunksPerSecond = 1000 / AudioProcessing::kChunkSizeMs; |
94 | 97 |
95 explicit AudioProcessingSimulator(const SimulationSettings& settings) | 98 explicit AudioProcessingSimulator(const SimulationSettings& settings); |
96 : settings_(settings) {} | 99 virtual ~AudioProcessingSimulator(); |
97 virtual ~AudioProcessingSimulator() {} | |
98 | 100 |
99 // Processes the data in the input. | 101 // Processes the data in the input. |
100 virtual void Process() = 0; | 102 virtual void Process() = 0; |
101 | 103 |
102 // Returns the execution time of all AudioProcessing calls. | 104 // Returns the execution time of all AudioProcessing calls. |
103 const TickIntervalStats& proc_time() const { return proc_time_; } | 105 const TickIntervalStats& proc_time() const { return proc_time_; } |
104 | 106 |
105 // Reports whether the processed recording was bitexact. | 107 // Reports whether the processed recording was bitexact. |
106 bool OutputWasBitexact() { return bitexact_output_; } | 108 bool OutputWasBitexact() { return bitexact_output_; } |
107 | 109 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_; | 169 std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_; |
168 TickIntervalStats proc_time_; | 170 TickIntervalStats proc_time_; |
169 | 171 |
170 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioProcessingSimulator); | 172 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioProcessingSimulator); |
171 }; | 173 }; |
172 | 174 |
173 } // namespace test | 175 } // namespace test |
174 } // namespace webrtc | 176 } // namespace webrtc |
175 | 177 |
176 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ | 178 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ |
OLD | NEW |