Alex Loiko | 6234722 | 2018-09-10 10:18:07 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 11 | #include "modules/audio_processing/test/runtime_setting_util.h" |
Per Åhgren | 6ee75fd | 2019-04-26 11:33:37 +0200 | [diff] [blame^] | 12 | |
Alex Loiko | 6234722 | 2018-09-10 10:18:07 +0200 | [diff] [blame] | 13 | #include "rtc_base/checks.h" |
| 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | void ReplayRuntimeSetting(AudioProcessing* apm, |
| 18 | const webrtc::audioproc::RuntimeSetting& setting) { |
| 19 | RTC_CHECK(apm); |
| 20 | // TODO(bugs.webrtc.org/9138): Add ability to handle different types |
Per Åhgren | 6ee75fd | 2019-04-26 11:33:37 +0200 | [diff] [blame^] | 21 | // of settings. Currently only CapturePreGain and CaptureFixedPostGain are |
| 22 | // supported. |
| 23 | RTC_CHECK(setting.has_capture_pre_gain() || |
| 24 | setting.has_capture_fixed_post_gain()); |
| 25 | |
| 26 | if (setting.has_capture_pre_gain()) { |
| 27 | apm->SetRuntimeSetting( |
| 28 | AudioProcessing::RuntimeSetting::CreateCapturePreGain( |
| 29 | setting.capture_pre_gain())); |
| 30 | } else if (setting.has_capture_fixed_post_gain()) { |
| 31 | apm->SetRuntimeSetting( |
| 32 | AudioProcessing::RuntimeSetting::CreateCaptureFixedPostGain( |
| 33 | setting.capture_fixed_post_gain())); |
| 34 | } |
Alex Loiko | 6234722 | 2018-09-10 10:18:07 +0200 | [diff] [blame] | 35 | } |
| 36 | } // namespace webrtc |