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 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <fstream> | 15 #include <fstream> |
16 #include <limits> | 16 #include <limits> |
17 #include <memory> | 17 #include <memory> |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 #include "webrtc/base/timeutils.h" | |
21 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
22 #include "webrtc/base/optional.h" | 21 #include "webrtc/base/optional.h" |
| 22 #include "webrtc/base/timeutils.h" |
23 #include "webrtc/common_audio/channel_buffer.h" | 23 #include "webrtc/common_audio/channel_buffer.h" |
24 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 24 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 25 #include "webrtc/modules/audio_processing/test/fake_recording_device.h" |
25 #include "webrtc/modules/audio_processing/test/test_utils.h" | 26 #include "webrtc/modules/audio_processing/test/test_utils.h" |
26 | 27 |
27 namespace webrtc { | 28 namespace webrtc { |
28 namespace test { | 29 namespace test { |
29 | 30 |
30 // TODO(alessiob): Check what initial value makes sense, 100 was used in | 31 // TODO(alessiob): Check what initial value makes sense, 100 was used in |
31 // WavBasedSimulator::last_specified_microphone_level_. | 32 // WavBasedSimulator::last_specified_microphone_level_. |
32 constexpr int kInitialMicrophoneGainLevel = 100; | 33 constexpr int kInitialMicrophoneGainLevel = 100; |
33 | 34 |
34 // Holds all the parameters available for controlling the simulation. | 35 // Holds all the parameters available for controlling the simulation. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 rtc::Optional<int> aecm_routing_mode; | 73 rtc::Optional<int> aecm_routing_mode; |
73 rtc::Optional<bool> use_aecm_comfort_noise; | 74 rtc::Optional<bool> use_aecm_comfort_noise; |
74 rtc::Optional<int> agc_mode; | 75 rtc::Optional<int> agc_mode; |
75 rtc::Optional<int> agc_target_level; | 76 rtc::Optional<int> agc_target_level; |
76 rtc::Optional<bool> use_agc_limiter; | 77 rtc::Optional<bool> use_agc_limiter; |
77 rtc::Optional<int> agc_compression_gain; | 78 rtc::Optional<int> agc_compression_gain; |
78 rtc::Optional<int> vad_likelihood; | 79 rtc::Optional<int> vad_likelihood; |
79 rtc::Optional<int> ns_level; | 80 rtc::Optional<int> ns_level; |
80 rtc::Optional<bool> use_refined_adaptive_filter; | 81 rtc::Optional<bool> use_refined_adaptive_filter; |
81 bool simulate_mic_gain = false; | 82 bool simulate_mic_gain = false; |
| 83 rtc::Optional<int> simulated_mic_kind; |
82 bool report_performance = false; | 84 bool report_performance = false; |
83 bool report_bitexactness = false; | 85 bool report_bitexactness = false; |
84 bool use_verbose_logging = false; | 86 bool use_verbose_logging = false; |
85 bool discard_all_settings_in_aecdump = true; | 87 bool discard_all_settings_in_aecdump = true; |
86 rtc::Optional<std::string> aec_dump_input_filename; | 88 rtc::Optional<std::string> aec_dump_input_filename; |
87 rtc::Optional<std::string> aec_dump_output_filename; | 89 rtc::Optional<std::string> aec_dump_output_filename; |
88 bool fixed_interface = false; | 90 bool fixed_interface = false; |
89 bool store_intermediate_output = false; | 91 bool store_intermediate_output = false; |
90 rtc::Optional<std::string> custom_call_order_filename; | 92 rtc::Optional<std::string> custom_call_order_filename; |
91 }; | 93 }; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 std::unique_ptr<ChannelBuffer<float>> reverse_out_buf_; | 164 std::unique_ptr<ChannelBuffer<float>> reverse_out_buf_; |
163 StreamConfig in_config_; | 165 StreamConfig in_config_; |
164 StreamConfig out_config_; | 166 StreamConfig out_config_; |
165 StreamConfig reverse_in_config_; | 167 StreamConfig reverse_in_config_; |
166 StreamConfig reverse_out_config_; | 168 StreamConfig reverse_out_config_; |
167 std::unique_ptr<ChannelBufferWavReader> buffer_reader_; | 169 std::unique_ptr<ChannelBufferWavReader> buffer_reader_; |
168 std::unique_ptr<ChannelBufferWavReader> reverse_buffer_reader_; | 170 std::unique_ptr<ChannelBufferWavReader> reverse_buffer_reader_; |
169 AudioFrame rev_frame_; | 171 AudioFrame rev_frame_; |
170 AudioFrame fwd_frame_; | 172 AudioFrame fwd_frame_; |
171 bool bitexact_output_ = true; | 173 bool bitexact_output_ = true; |
| 174 rtc::Optional<FakeRecordingDevice> fake_recording_device_; |
172 | 175 |
173 private: | 176 private: |
174 void SetupOutput(); | 177 void SetupOutput(); |
175 | 178 |
176 size_t num_process_stream_calls_ = 0; | 179 size_t num_process_stream_calls_ = 0; |
177 size_t num_reverse_process_stream_calls_ = 0; | 180 size_t num_reverse_process_stream_calls_ = 0; |
178 size_t output_reset_counter_ = 0; | 181 size_t output_reset_counter_ = 0; |
179 std::unique_ptr<ChannelBufferWavWriter> buffer_writer_; | 182 std::unique_ptr<ChannelBufferWavWriter> buffer_writer_; |
180 std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_; | 183 std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_; |
181 TickIntervalStats proc_time_; | 184 TickIntervalStats proc_time_; |
182 std::ofstream residual_echo_likelihood_graph_writer_; | 185 std::ofstream residual_echo_likelihood_graph_writer_; |
183 | 186 |
184 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioProcessingSimulator); | 187 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioProcessingSimulator); |
185 }; | 188 }; |
186 | 189 |
187 } // namespace test | 190 } // namespace test |
188 } // namespace webrtc | 191 } // namespace webrtc |
189 | 192 |
190 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ | 193 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ |
OLD | NEW |