blob: bc5f700bf23a4fbcdcd6e165289a488be0578738 [file] [log] [blame]
Alex Loiko62347222018-09-10 10:18:07 +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
11#include "modules/audio_processing/test/runtime_setting_util.h"
Per Åhgren6ee75fd2019-04-26 11:33:37 +020012
Alex Loiko62347222018-09-10 10:18:07 +020013#include "rtc_base/checks.h"
14
15namespace webrtc {
16
17void 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 Åhgren6ee75fd2019-04-26 11:33:37 +020021 // 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 Loiko62347222018-09-10 10:18:07 +020035}
36} // namespace webrtc