blob: b6197157201d166c46ff6713936662b5c8b2723a [file] [log] [blame]
Sam Zackrissona4c85142018-10-10 10:44:43 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10#include "api/audio/echo_canceller3_config_json.h"
11
12#include <string>
13#include <vector>
14
15#include "rtc_base/logging.h"
16#include "rtc_base/strings/json.h"
17#include "rtc_base/strings/string_builder.h"
18
19namespace webrtc {
20namespace {
21void ReadParam(const Json::Value& root, std::string param_name, bool* param) {
22 RTC_DCHECK(param);
23 bool v;
24 if (rtc::GetBoolFromJsonObject(root, param_name, &v)) {
25 *param = v;
26 }
27}
28
29void ReadParam(const Json::Value& root, std::string param_name, size_t* param) {
30 RTC_DCHECK(param);
31 int v;
32 if (rtc::GetIntFromJsonObject(root, param_name, &v)) {
33 *param = v;
34 }
35}
36
37void ReadParam(const Json::Value& root, std::string param_name, int* param) {
38 RTC_DCHECK(param);
39 int v;
40 if (rtc::GetIntFromJsonObject(root, param_name, &v)) {
41 *param = v;
42 }
43}
44
45void ReadParam(const Json::Value& root, std::string param_name, float* param) {
46 RTC_DCHECK(param);
47 double v;
48 if (rtc::GetDoubleFromJsonObject(root, param_name, &v)) {
49 *param = static_cast<float>(v);
50 }
51}
52
53void ReadParam(const Json::Value& root,
54 std::string param_name,
55 EchoCanceller3Config::Filter::MainConfiguration* param) {
Sam Zackrisson703259c2018-10-10 17:17:43 +020056 RTC_DCHECK(param);
Sam Zackrissona4c85142018-10-10 10:44:43 +020057 Json::Value json_array;
58 if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
59 std::vector<double> v;
60 rtc::JsonArrayToDoubleVector(json_array, &v);
61 if (v.size() != 6) {
62 RTC_LOG(LS_ERROR) << "Incorrect array size for " << param_name;
Sam Zackrisson703259c2018-10-10 17:17:43 +020063 return;
Sam Zackrissona4c85142018-10-10 10:44:43 +020064 }
65 param->length_blocks = static_cast<size_t>(v[0]);
66 param->leakage_converged = static_cast<float>(v[1]);
67 param->leakage_diverged = static_cast<float>(v[2]);
68 param->error_floor = static_cast<float>(v[3]);
69 param->error_ceil = static_cast<float>(v[4]);
70 param->noise_gate = static_cast<float>(v[5]);
71 }
72}
73
74void ReadParam(const Json::Value& root,
75 std::string param_name,
76 EchoCanceller3Config::Filter::ShadowConfiguration* param) {
Sam Zackrisson703259c2018-10-10 17:17:43 +020077 RTC_DCHECK(param);
Sam Zackrissona4c85142018-10-10 10:44:43 +020078 Json::Value json_array;
79 if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
80 std::vector<double> v;
81 rtc::JsonArrayToDoubleVector(json_array, &v);
82 if (v.size() != 3) {
83 RTC_LOG(LS_ERROR) << "Incorrect array size for " << param_name;
Sam Zackrisson703259c2018-10-10 17:17:43 +020084 return;
Sam Zackrissona4c85142018-10-10 10:44:43 +020085 }
86 param->length_blocks = static_cast<size_t>(v[0]);
87 param->rate = static_cast<float>(v[1]);
88 param->noise_gate = static_cast<float>(v[2]);
89 }
90}
91
92void ReadParam(const Json::Value& root,
93 std::string param_name,
94 EchoCanceller3Config::Suppressor::MaskingThresholds* param) {
Sam Zackrisson703259c2018-10-10 17:17:43 +020095 RTC_DCHECK(param);
Sam Zackrissona4c85142018-10-10 10:44:43 +020096 Json::Value json_array;
97 if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
98 std::vector<double> v;
99 rtc::JsonArrayToDoubleVector(json_array, &v);
100 if (v.size() != 3) {
101 RTC_LOG(LS_ERROR) << "Incorrect array size for " << param_name;
Sam Zackrisson703259c2018-10-10 17:17:43 +0200102 return;
Sam Zackrissona4c85142018-10-10 10:44:43 +0200103 }
104 param->enr_transparent = static_cast<float>(v[0]);
105 param->enr_suppress = static_cast<float>(v[1]);
106 param->emr_transparent = static_cast<float>(v[2]);
107 }
108}
109} // namespace
110
111EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string) {
112 EchoCanceller3Config cfg;
113
114 Json::Value root;
115 bool success = Json::Reader().parse(std::string(json_string), root);
116 if (!success) {
117 RTC_LOG(LS_ERROR) << "Incorrect JSON format: " << json_string;
118 return EchoCanceller3Config();
119 }
120
121 Json::Value aec3_root;
122 success = rtc::GetValueFromJsonObject(root, "aec3", &aec3_root);
123 if (!success) {
124 RTC_LOG(LS_ERROR) << "Missing AEC3 config field: " << json_string;
125 return EchoCanceller3Config();
126 }
127
128 Json::Value section;
Gustaf Ullberg11539f02018-10-15 13:40:29 +0200129 if (rtc::GetValueFromJsonObject(root, "buffering", &section)) {
130 ReadParam(section, "use_new_render_buffering",
131 &cfg.buffering.use_new_render_buffering);
132 ReadParam(section, "excess_render_detection_interval_blocks",
133 &cfg.buffering.excess_render_detection_interval_blocks);
134 ReadParam(section, "max_allowed_excess_render_blocks",
135 &cfg.buffering.max_allowed_excess_render_blocks);
136 }
137
Sam Zackrissona4c85142018-10-10 10:44:43 +0200138 if (rtc::GetValueFromJsonObject(aec3_root, "delay", &section)) {
139 ReadParam(section, "default_delay", &cfg.delay.default_delay);
140 ReadParam(section, "down_sampling_factor", &cfg.delay.down_sampling_factor);
141 ReadParam(section, "num_filters", &cfg.delay.num_filters);
142 ReadParam(section, "api_call_jitter_blocks",
143 &cfg.delay.api_call_jitter_blocks);
144 ReadParam(section, "min_echo_path_delay_blocks",
145 &cfg.delay.min_echo_path_delay_blocks);
146 ReadParam(section, "delay_headroom_blocks",
147 &cfg.delay.delay_headroom_blocks);
148 ReadParam(section, "hysteresis_limit_1_blocks",
149 &cfg.delay.hysteresis_limit_1_blocks);
150 ReadParam(section, "hysteresis_limit_2_blocks",
151 &cfg.delay.hysteresis_limit_2_blocks);
152 ReadParam(section, "skew_hysteresis_blocks",
153 &cfg.delay.skew_hysteresis_blocks);
154 ReadParam(section, "fixed_capture_delay_samples",
155 &cfg.delay.fixed_capture_delay_samples);
156 ReadParam(section, "delay_estimate_smoothing",
157 &cfg.delay.delay_estimate_smoothing);
158 ReadParam(section, "delay_candidate_detection_threshold",
159 &cfg.delay.delay_candidate_detection_threshold);
160
161 Json::Value subsection;
162 if (rtc::GetValueFromJsonObject(section, "delay_selection_thresholds",
163 &subsection)) {
164 ReadParam(subsection, "initial",
165 &cfg.delay.delay_selection_thresholds.initial);
166 ReadParam(subsection, "converged",
167 &cfg.delay.delay_selection_thresholds.converged);
168 }
169 }
170
171 if (rtc::GetValueFromJsonObject(aec3_root, "filter", &section)) {
172 ReadParam(section, "main", &cfg.filter.main);
173 ReadParam(section, "shadow", &cfg.filter.shadow);
174 ReadParam(section, "main_initial", &cfg.filter.main_initial);
175 ReadParam(section, "shadow_initial", &cfg.filter.shadow_initial);
176 ReadParam(section, "config_change_duration_blocks",
177 &cfg.filter.config_change_duration_blocks);
178 ReadParam(section, "initial_state_seconds",
179 &cfg.filter.initial_state_seconds);
180 ReadParam(section, "conservative_initial_phase",
181 &cfg.filter.conservative_initial_phase);
182 ReadParam(section, "enable_shadow_filter_output_usage",
183 &cfg.filter.enable_shadow_filter_output_usage);
184 }
185
186 if (rtc::GetValueFromJsonObject(aec3_root, "erle", &section)) {
187 ReadParam(section, "min", &cfg.erle.min);
188 ReadParam(section, "max_l", &cfg.erle.max_l);
189 ReadParam(section, "max_h", &cfg.erle.max_h);
190 ReadParam(section, "onset_detection", &cfg.erle.onset_detection);
191 }
192
193 if (rtc::GetValueFromJsonObject(aec3_root, "ep_strength", &section)) {
194 ReadParam(section, "lf", &cfg.ep_strength.lf);
195 ReadParam(section, "mf", &cfg.ep_strength.mf);
196 ReadParam(section, "hf", &cfg.ep_strength.hf);
197 ReadParam(section, "default_len", &cfg.ep_strength.default_len);
198 ReadParam(section, "reverb_based_on_render",
199 &cfg.ep_strength.reverb_based_on_render);
200 ReadParam(section, "echo_can_saturate", &cfg.ep_strength.echo_can_saturate);
201 ReadParam(section, "bounded_erl", &cfg.ep_strength.bounded_erl);
202 }
203
Sam Zackrissona4c85142018-10-10 10:44:43 +0200204 if (rtc::GetValueFromJsonObject(aec3_root, "echo_audibility", &section)) {
205 ReadParam(section, "low_render_limit",
206 &cfg.echo_audibility.low_render_limit);
207 ReadParam(section, "normal_render_limit",
208 &cfg.echo_audibility.normal_render_limit);
209
210 ReadParam(section, "floor_power", &cfg.echo_audibility.floor_power);
211 ReadParam(section, "audibility_threshold_lf",
212 &cfg.echo_audibility.audibility_threshold_lf);
213 ReadParam(section, "audibility_threshold_mf",
214 &cfg.echo_audibility.audibility_threshold_mf);
215 ReadParam(section, "audibility_threshold_hf",
216 &cfg.echo_audibility.audibility_threshold_hf);
217 ReadParam(section, "use_stationary_properties",
218 &cfg.echo_audibility.use_stationary_properties);
219 ReadParam(section, "use_stationary_properties_at_init",
220 &cfg.echo_audibility.use_stationarity_properties_at_init);
221 }
222
223 if (rtc::GetValueFromJsonObject(aec3_root, "echo_removal_control",
224 &section)) {
225 Json::Value subsection;
226 if (rtc::GetValueFromJsonObject(section, "gain_rampup", &subsection)) {
227 ReadParam(subsection, "initial_gain",
228 &cfg.echo_removal_control.gain_rampup.initial_gain);
229 ReadParam(subsection, "first_non_zero_gain",
230 &cfg.echo_removal_control.gain_rampup.first_non_zero_gain);
231 ReadParam(subsection, "non_zero_gain_blocks",
232 &cfg.echo_removal_control.gain_rampup.non_zero_gain_blocks);
233 ReadParam(subsection, "full_gain_blocks",
234 &cfg.echo_removal_control.gain_rampup.full_gain_blocks);
235 }
236 ReadParam(section, "has_clock_drift",
237 &cfg.echo_removal_control.has_clock_drift);
238 ReadParam(section, "linear_and_stable_echo_path",
239 &cfg.echo_removal_control.linear_and_stable_echo_path);
240 }
241
242 if (rtc::GetValueFromJsonObject(aec3_root, "echo_model", &section)) {
243 Json::Value subsection;
244 ReadParam(section, "noise_floor_hold", &cfg.echo_model.noise_floor_hold);
245 ReadParam(section, "min_noise_floor_power",
246 &cfg.echo_model.min_noise_floor_power);
247 ReadParam(section, "stationary_gate_slope",
248 &cfg.echo_model.stationary_gate_slope);
249 ReadParam(section, "noise_gate_power", &cfg.echo_model.noise_gate_power);
250 ReadParam(section, "noise_gate_slope", &cfg.echo_model.noise_gate_slope);
251 ReadParam(section, "render_pre_window_size",
252 &cfg.echo_model.render_pre_window_size);
253 ReadParam(section, "render_post_window_size",
254 &cfg.echo_model.render_post_window_size);
255 ReadParam(section, "render_pre_window_size_init",
256 &cfg.echo_model.render_pre_window_size_init);
257 ReadParam(section, "render_post_window_size_init",
258 &cfg.echo_model.render_post_window_size_init);
259 ReadParam(section, "nonlinear_hold", &cfg.echo_model.nonlinear_hold);
260 ReadParam(section, "nonlinear_release", &cfg.echo_model.nonlinear_release);
261 }
262
263 Json::Value subsection;
264 if (rtc::GetValueFromJsonObject(aec3_root, "suppressor", &section)) {
265 ReadParam(section, "nearend_average_blocks",
266 &cfg.suppressor.nearend_average_blocks);
267
268 if (rtc::GetValueFromJsonObject(section, "normal_tuning", &subsection)) {
269 ReadParam(subsection, "mask_lf", &cfg.suppressor.normal_tuning.mask_lf);
270 ReadParam(subsection, "mask_hf", &cfg.suppressor.normal_tuning.mask_hf);
271 ReadParam(subsection, "max_inc_factor",
272 &cfg.suppressor.normal_tuning.max_inc_factor);
273 ReadParam(subsection, "max_dec_factor_lf",
274 &cfg.suppressor.normal_tuning.max_dec_factor_lf);
275 }
276
277 if (rtc::GetValueFromJsonObject(section, "nearend_tuning", &subsection)) {
278 ReadParam(subsection, "mask_lf", &cfg.suppressor.nearend_tuning.mask_lf);
279 ReadParam(subsection, "mask_hf", &cfg.suppressor.nearend_tuning.mask_hf);
280 ReadParam(subsection, "max_inc_factor",
281 &cfg.suppressor.nearend_tuning.max_inc_factor);
282 ReadParam(subsection, "max_dec_factor_lf",
283 &cfg.suppressor.nearend_tuning.max_dec_factor_lf);
284 }
285
286 if (rtc::GetValueFromJsonObject(section, "dominant_nearend_detection",
287 &subsection)) {
288 ReadParam(subsection, "enr_threshold",
289 &cfg.suppressor.dominant_nearend_detection.enr_threshold);
290 ReadParam(subsection, "snr_threshold",
291 &cfg.suppressor.dominant_nearend_detection.snr_threshold);
292 ReadParam(subsection, "hold_duration",
293 &cfg.suppressor.dominant_nearend_detection.hold_duration);
294 ReadParam(subsection, "trigger_threshold",
295 &cfg.suppressor.dominant_nearend_detection.trigger_threshold);
296 }
297
298 if (rtc::GetValueFromJsonObject(section, "high_bands_suppression",
299 &subsection)) {
300 ReadParam(subsection, "enr_threshold",
301 &cfg.suppressor.high_bands_suppression.enr_threshold);
302 ReadParam(subsection, "max_gain_during_echo",
303 &cfg.suppressor.high_bands_suppression.max_gain_during_echo);
304 }
305
306 ReadParam(section, "floor_first_increase",
307 &cfg.suppressor.floor_first_increase);
308 ReadParam(section, "enforce_transparent",
309 &cfg.suppressor.enforce_transparent);
310 ReadParam(section, "enforce_empty_higher_bands",
311 &cfg.suppressor.enforce_empty_higher_bands);
312 }
313 return cfg;
314}
315
316std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
317 rtc::StringBuilder ost;
318 ost << "{";
319 ost << "\"aec3\": {";
320 ost << "\"delay\": {";
321 ost << "\"default_delay\": " << config.delay.default_delay << ",";
322 ost << "\"down_sampling_factor\": " << config.delay.down_sampling_factor
323 << ",";
324 ost << "\"num_filters\": " << config.delay.num_filters << ",";
325 ost << "\"api_call_jitter_blocks\": " << config.delay.api_call_jitter_blocks
326 << ",";
327 ost << "\"min_echo_path_delay_blocks\": "
328 << config.delay.min_echo_path_delay_blocks << ",";
329 ost << "\"delay_headroom_blocks\": " << config.delay.delay_headroom_blocks
330 << ",";
331 ost << "\"hysteresis_limit_1_blocks\": "
332 << config.delay.hysteresis_limit_1_blocks << ",";
333 ost << "\"hysteresis_limit_2_blocks\": "
334 << config.delay.hysteresis_limit_2_blocks << ",";
335 ost << "\"skew_hysteresis_blocks\": " << config.delay.skew_hysteresis_blocks
336 << ",";
337 ost << "\"fixed_capture_delay_samples\": "
338 << config.delay.fixed_capture_delay_samples << ",";
339 ost << "\"delay_estimate_smoothing\": "
340 << config.delay.delay_estimate_smoothing << ",";
341 ost << "\"delay_candidate_detection_threshold\": "
342 << config.delay.delay_candidate_detection_threshold << ",";
343
344 ost << "\"delay_selection_thresholds\": {";
345 ost << "\"initial\": " << config.delay.delay_selection_thresholds.initial
346 << ",";
347 ost << "\"converged\": " << config.delay.delay_selection_thresholds.converged;
348 ost << "}";
349
350 ost << "},";
351
352 ost << "\"filter\": {";
353 ost << "\"main\": [";
354 ost << config.filter.main.length_blocks << ",";
355 ost << config.filter.main.leakage_converged << ",";
356 ost << config.filter.main.leakage_diverged << ",";
357 ost << config.filter.main.error_floor << ",";
358 ost << config.filter.main.error_ceil << ",";
359 ost << config.filter.main.noise_gate;
360 ost << "],";
361
362 ost << "\"shadow\": [";
363 ost << config.filter.shadow.length_blocks << ",";
364 ost << config.filter.shadow.rate << ",";
365 ost << config.filter.shadow.noise_gate;
366 ost << "],";
367
368 ost << "\"main_initial\": [";
369 ost << config.filter.main_initial.length_blocks << ",";
370 ost << config.filter.main_initial.leakage_converged << ",";
371 ost << config.filter.main_initial.leakage_diverged << ",";
372 ost << config.filter.main_initial.error_floor << ",";
373 ost << config.filter.main_initial.error_ceil << ",";
374 ost << config.filter.main_initial.noise_gate;
375 ost << "],";
376
377 ost << "\"shadow_initial\": [";
378 ost << config.filter.shadow_initial.length_blocks << ",";
379 ost << config.filter.shadow_initial.rate << ",";
380 ost << config.filter.shadow_initial.noise_gate;
381 ost << "],";
382
383 ost << "\"config_change_duration_blocks\": "
384 << config.filter.config_change_duration_blocks << ",";
385 ost << "\"initial_state_seconds\": " << config.filter.initial_state_seconds
386 << ",";
387 ost << "\"conservative_initial_phase\": "
388 << (config.filter.conservative_initial_phase ? "true" : "false") << ",";
389 ost << "\"enable_shadow_filter_output_usage\": "
390 << (config.filter.enable_shadow_filter_output_usage ? "true" : "false");
391
392 ost << "},";
393
394 ost << "\"erle\": {";
395 ost << "\"min\": " << config.erle.min << ",";
396 ost << "\"max_l\": " << config.erle.max_l << ",";
397 ost << "\"max_h\": " << config.erle.max_h << ",";
398 ost << "\"onset_detection\": "
399 << (config.erle.onset_detection ? "true" : "false");
400 ost << "},";
401
402 ost << "\"ep_strength\": {";
403 ost << "\"lf\": " << config.ep_strength.lf << ",";
404 ost << "\"mf\": " << config.ep_strength.mf << ",";
405 ost << "\"hf\": " << config.ep_strength.hf << ",";
406 ost << "\"default_len\": " << config.ep_strength.default_len << ",";
407 ost << "\"reverb_based_on_render\": "
408 << (config.ep_strength.reverb_based_on_render ? "true" : "false") << ",";
409 ost << "\"echo_can_saturate\": "
410 << (config.ep_strength.echo_can_saturate ? "true" : "false") << ",";
411 ost << "\"bounded_erl\": "
412 << (config.ep_strength.bounded_erl ? "true" : "false");
413
414 ost << "},";
415
Sam Zackrissona4c85142018-10-10 10:44:43 +0200416 ost << "\"echo_audibility\": {";
417 ost << "\"low_render_limit\": " << config.echo_audibility.low_render_limit
418 << ",";
419 ost << "\"normal_render_limit\": "
420 << config.echo_audibility.normal_render_limit << ",";
421 ost << "\"floor_power\": " << config.echo_audibility.floor_power << ",";
422 ost << "\"audibility_threshold_lf\": "
423 << config.echo_audibility.audibility_threshold_lf << ",";
424 ost << "\"audibility_threshold_mf\": "
425 << config.echo_audibility.audibility_threshold_mf << ",";
426 ost << "\"audibility_threshold_hf\": "
427 << config.echo_audibility.audibility_threshold_hf << ",";
428 ost << "\"use_stationary_properties\": "
429 << (config.echo_audibility.use_stationary_properties ? "true" : "false")
430 << ",";
431 ost << "\"use_stationarity_properties_at_init\": "
432 << (config.echo_audibility.use_stationarity_properties_at_init ? "true"
433 : "false");
434 ost << "},";
435
436 ost << "\"render_levels\": {";
437 ost << "\"active_render_limit\": " << config.render_levels.active_render_limit
438 << ",";
439 ost << "\"poor_excitation_render_limit\": "
440 << config.render_levels.poor_excitation_render_limit << ",";
441 ost << "\"poor_excitation_render_limit_ds8\": "
442 << config.render_levels.poor_excitation_render_limit_ds8;
443 ost << "},";
444
445 ost << "\"echo_removal_control\": {";
446 ost << "\"gain_rampup\": {";
447 ost << "\"initial_gain\": "
448 << config.echo_removal_control.gain_rampup.initial_gain << ",";
449 ost << "\"first_non_zero_gain\": "
450 << config.echo_removal_control.gain_rampup.first_non_zero_gain << ",";
451 ost << "\"non_zero_gain_blocks\": "
452 << config.echo_removal_control.gain_rampup.non_zero_gain_blocks << ",";
453 ost << "\"full_gain_blocks\": "
454 << config.echo_removal_control.gain_rampup.full_gain_blocks;
455 ost << "},";
456 ost << "\"has_clock_drift\": "
457 << (config.echo_removal_control.has_clock_drift ? "true" : "false")
458 << ",";
459 ost << "\"linear_and_stable_echo_path\": "
460 << (config.echo_removal_control.linear_and_stable_echo_path ? "true"
461 : "false");
462
463 ost << "},";
464
465 ost << "\"echo_model\": {";
466 ost << "\"noise_floor_hold\": " << config.echo_model.noise_floor_hold << ",";
467 ost << "\"min_noise_floor_power\": "
468 << config.echo_model.min_noise_floor_power << ",";
469 ost << "\"stationary_gate_slope\": "
470 << config.echo_model.stationary_gate_slope << ",";
471 ost << "\"noise_gate_power\": " << config.echo_model.noise_gate_power << ",";
472 ost << "\"noise_gate_slope\": " << config.echo_model.noise_gate_slope << ",";
473 ost << "\"render_pre_window_size\": "
474 << config.echo_model.render_pre_window_size << ",";
475 ost << "\"render_post_window_size\": "
476 << config.echo_model.render_post_window_size << ",";
477 ost << "\"render_pre_window_size_init\": "
478 << config.echo_model.render_pre_window_size_init << ",";
479 ost << "\"render_post_window_size_init\": "
480 << config.echo_model.render_post_window_size_init << ",";
481 ost << "\"nonlinear_hold\": " << config.echo_model.nonlinear_hold << ",";
482 ost << "\"nonlinear_release\": " << config.echo_model.nonlinear_release;
483 ost << "},";
484
485 ost << "\"suppressor\": {";
486 ost << "\"nearend_average_blocks\": "
487 << config.suppressor.nearend_average_blocks << ",";
488 ost << "\"normal_tuning\": {";
489 ost << "\"mask_lf\": [";
490 ost << config.suppressor.normal_tuning.mask_lf.enr_transparent << ",";
491 ost << config.suppressor.normal_tuning.mask_lf.enr_suppress << ",";
492 ost << config.suppressor.normal_tuning.mask_lf.emr_transparent;
493 ost << "],";
494 ost << "\"mask_hf\": [";
495 ost << config.suppressor.normal_tuning.mask_hf.enr_transparent << ",";
496 ost << config.suppressor.normal_tuning.mask_hf.enr_suppress << ",";
497 ost << config.suppressor.normal_tuning.mask_hf.emr_transparent;
498 ost << "],";
499 ost << "\"max_inc_factor\": "
500 << config.suppressor.normal_tuning.max_inc_factor << ",";
501 ost << "\"max_dec_factor_lf\": "
502 << config.suppressor.normal_tuning.max_dec_factor_lf;
503 ost << "},";
504 ost << "\"nearend_tuning\": {";
505 ost << "\"mask_lf\": [";
506 ost << config.suppressor.nearend_tuning.mask_lf.enr_transparent << ",";
507 ost << config.suppressor.nearend_tuning.mask_lf.enr_suppress << ",";
508 ost << config.suppressor.nearend_tuning.mask_lf.emr_transparent;
509 ost << "],";
510 ost << "\"mask_hf\": [";
511 ost << config.suppressor.nearend_tuning.mask_hf.enr_transparent << ",";
512 ost << config.suppressor.nearend_tuning.mask_hf.enr_suppress << ",";
513 ost << config.suppressor.nearend_tuning.mask_hf.emr_transparent;
514 ost << "],";
515 ost << "\"max_inc_factor\": "
516 << config.suppressor.nearend_tuning.max_inc_factor << ",";
517 ost << "\"max_dec_factor_lf\": "
518 << config.suppressor.nearend_tuning.max_dec_factor_lf;
519 ost << "},";
520 ost << "\"dominant_nearend_detection\": {";
521 ost << "\"enr_threshold\": "
522 << config.suppressor.dominant_nearend_detection.enr_threshold << ",";
523 ost << "\"snr_threshold\": "
524 << config.suppressor.dominant_nearend_detection.snr_threshold << ",";
525 ost << "\"hold_duration\": "
526 << config.suppressor.dominant_nearend_detection.hold_duration << ",";
527 ost << "\"trigger_threshold\": "
528 << config.suppressor.dominant_nearend_detection.trigger_threshold;
529 ost << "},";
530 ost << "\"high_bands_suppression\": {";
531 ost << "\"enr_threshold\": "
532 << config.suppressor.high_bands_suppression.enr_threshold << ",";
533 ost << "\"max_gain_during_echo\": "
534 << config.suppressor.high_bands_suppression.max_gain_during_echo;
535 ost << "},";
536 ost << "\"floor_first_increase\": " << config.suppressor.floor_first_increase
537 << ",";
538 ost << "\"enforce_transparent\": "
539 << (config.suppressor.enforce_transparent ? "true" : "false") << ",";
540 ost << "\"enforce_empty_higher_bands\": "
541 << (config.suppressor.enforce_empty_higher_bands ? "true" : "false");
542 ost << "}";
543 ost << "}";
544 ost << "}";
545
546 return ost.Release();
547}
548} // namespace webrtc