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" 12 13 #include "rtc_base/checks.h" 14 15 namespace webrtc { 16 ReplayRuntimeSetting(AudioProcessing * apm,const webrtc::audioproc::RuntimeSetting & setting)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 21 // of settings. Currently CapturePreGain, CaptureFixedPostGain and 22 // PlayoutVolumeChange are supported. 23 RTC_CHECK(setting.has_capture_pre_gain() || 24 setting.has_capture_fixed_post_gain() || 25 setting.has_playout_volume_change()); 26 27 if (setting.has_capture_pre_gain()) { 28 apm->SetRuntimeSetting( 29 AudioProcessing::RuntimeSetting::CreateCapturePreGain( 30 setting.capture_pre_gain())); 31 } else if (setting.has_capture_fixed_post_gain()) { 32 apm->SetRuntimeSetting( 33 AudioProcessing::RuntimeSetting::CreateCaptureFixedPostGain( 34 setting.capture_fixed_post_gain())); 35 } else if (setting.has_playout_volume_change()) { 36 apm->SetRuntimeSetting( 37 AudioProcessing::RuntimeSetting::CreatePlayoutVolumeChange( 38 setting.playout_volume_change())); 39 } else if (setting.has_playout_audio_device_change()) { 40 apm->SetRuntimeSetting( 41 AudioProcessing::RuntimeSetting::CreatePlayoutAudioDeviceChange( 42 {setting.playout_audio_device_change().id(), 43 setting.playout_audio_device_change().max_volume()})); 44 } 45 } 46 } // namespace webrtc 47