Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: webrtc/modules/audio_processing/test/audio_processing_simulator.h

Issue 2834643002: audioproc_f with simulated mic analog gain (Closed)
Patch Set: FakeRecordingDevice interface simplified, UTs fixes, logs verbosity-- Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Holds all the parameters available for controlling the simulation. 31 // Holds all the parameters available for controlling the simulation.
31 struct SimulationSettings { 32 struct SimulationSettings {
32 SimulationSettings(); 33 SimulationSettings();
33 SimulationSettings(const SimulationSettings&); 34 SimulationSettings(const SimulationSettings&);
34 ~SimulationSettings(); 35 ~SimulationSettings();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 rtc::Optional<bool> use_experimental_agc; 68 rtc::Optional<bool> use_experimental_agc;
68 rtc::Optional<int> aecm_routing_mode; 69 rtc::Optional<int> aecm_routing_mode;
69 rtc::Optional<bool> use_aecm_comfort_noise; 70 rtc::Optional<bool> use_aecm_comfort_noise;
70 rtc::Optional<int> agc_mode; 71 rtc::Optional<int> agc_mode;
71 rtc::Optional<int> agc_target_level; 72 rtc::Optional<int> agc_target_level;
72 rtc::Optional<bool> use_agc_limiter; 73 rtc::Optional<bool> use_agc_limiter;
73 rtc::Optional<int> agc_compression_gain; 74 rtc::Optional<int> agc_compression_gain;
74 rtc::Optional<int> vad_likelihood; 75 rtc::Optional<int> vad_likelihood;
75 rtc::Optional<int> ns_level; 76 rtc::Optional<int> ns_level;
76 rtc::Optional<bool> use_refined_adaptive_filter; 77 rtc::Optional<bool> use_refined_adaptive_filter;
78 int initial_mic_gain;
79 bool simulate_mic_gain = false;
80 rtc::Optional<int> simulated_mic_kind;
aleloi 2017/05/08 10:15:23 I suggest convert to FakeRecordingDevice::LevelToS
peah-webrtc 2017/05/08 11:41:33 That makes sense, but the code storing the command
aleloi 2017/05/08 12:40:49 Ok, I didn't look close enough.
AleBzk 2017/05/16 08:53:03 If I understand well, it's fine as it is now since
77 bool report_performance = false; 81 bool report_performance = false;
78 bool report_bitexactness = false; 82 bool report_bitexactness = false;
79 bool use_verbose_logging = false; 83 bool use_verbose_logging = false;
80 bool discard_all_settings_in_aecdump = true; 84 bool discard_all_settings_in_aecdump = true;
81 rtc::Optional<std::string> aec_dump_input_filename; 85 rtc::Optional<std::string> aec_dump_input_filename;
82 rtc::Optional<std::string> aec_dump_output_filename; 86 rtc::Optional<std::string> aec_dump_output_filename;
83 bool fixed_interface = false; 87 bool fixed_interface = false;
84 bool store_intermediate_output = false; 88 bool store_intermediate_output = false;
85 rtc::Optional<std::string> custom_call_order_filename; 89 rtc::Optional<std::string> custom_call_order_filename;
86 }; 90 };
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 std::unique_ptr<ChannelBuffer<float>> reverse_out_buf_; 161 std::unique_ptr<ChannelBuffer<float>> reverse_out_buf_;
158 StreamConfig in_config_; 162 StreamConfig in_config_;
159 StreamConfig out_config_; 163 StreamConfig out_config_;
160 StreamConfig reverse_in_config_; 164 StreamConfig reverse_in_config_;
161 StreamConfig reverse_out_config_; 165 StreamConfig reverse_out_config_;
162 std::unique_ptr<ChannelBufferWavReader> buffer_reader_; 166 std::unique_ptr<ChannelBufferWavReader> buffer_reader_;
163 std::unique_ptr<ChannelBufferWavReader> reverse_buffer_reader_; 167 std::unique_ptr<ChannelBufferWavReader> reverse_buffer_reader_;
164 AudioFrame rev_frame_; 168 AudioFrame rev_frame_;
165 AudioFrame fwd_frame_; 169 AudioFrame fwd_frame_;
166 bool bitexact_output_ = true; 170 bool bitexact_output_ = true;
171 int last_specified_microphone_level_;
172 int real_recording_device_level_ =
173 FakeRecordingDevice::kRealDeviceLevelUnknown;
167 174
168 private: 175 private:
169 void SetupOutput(); 176 void SetupOutput();
170 177
171 size_t num_process_stream_calls_ = 0; 178 size_t num_process_stream_calls_ = 0;
172 size_t num_reverse_process_stream_calls_ = 0; 179 size_t num_reverse_process_stream_calls_ = 0;
173 size_t output_reset_counter_ = 0; 180 size_t output_reset_counter_ = 0;
174 std::unique_ptr<ChannelBufferWavWriter> buffer_writer_; 181 std::unique_ptr<ChannelBufferWavWriter> buffer_writer_;
175 std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_; 182 std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_;
176 TickIntervalStats proc_time_; 183 TickIntervalStats proc_time_;
177 std::ofstream residual_echo_likelihood_graph_writer_; 184 std::ofstream residual_echo_likelihood_graph_writer_;
185 FakeRecordingDevice fake_recording_device_;
178 186
179 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioProcessingSimulator); 187 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioProcessingSimulator);
180 }; 188 };
181 189
182 } // namespace test 190 } // namespace test
183 } // namespace webrtc 191 } // namespace webrtc
184 192
185 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_ 193 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_SIMULATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698