tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

runtime_setting_util.cc (2207B)


      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 "api/audio/audio_processing.h"
     14 #include "modules/audio_processing/test/protobuf_utils.h"
     15 #include "rtc_base/checks.h"
     16 
     17 namespace webrtc {
     18 
     19 void ReplayRuntimeSetting(AudioProcessing* apm,
     20                          const audioproc::RuntimeSetting& setting) {
     21  RTC_CHECK(apm);
     22  // TODO(bugs.webrtc.org/9138): Add ability to handle different types
     23  // of settings. Currently CapturePreGain, CaptureFixedPostGain and
     24  // PlayoutVolumeChange are supported.
     25  RTC_CHECK(setting.has_capture_pre_gain() ||
     26            setting.has_capture_fixed_post_gain() ||
     27            setting.has_playout_volume_change());
     28 
     29  if (setting.has_capture_pre_gain()) {
     30    apm->SetRuntimeSetting(
     31        AudioProcessing::RuntimeSetting::CreateCapturePreGain(
     32            setting.capture_pre_gain()));
     33  } else if (setting.has_capture_fixed_post_gain()) {
     34    apm->SetRuntimeSetting(
     35        AudioProcessing::RuntimeSetting::CreateCaptureFixedPostGain(
     36            setting.capture_fixed_post_gain()));
     37  } else if (setting.has_playout_volume_change()) {
     38    apm->SetRuntimeSetting(
     39        AudioProcessing::RuntimeSetting::CreatePlayoutVolumeChange(
     40            setting.playout_volume_change()));
     41  } else if (setting.has_playout_audio_device_change()) {
     42    apm->SetRuntimeSetting(
     43        AudioProcessing::RuntimeSetting::CreatePlayoutAudioDeviceChange(
     44            {.id = setting.playout_audio_device_change().id(),
     45             .max_volume =
     46                 setting.playout_audio_device_change().max_volume()}));
     47  } else if (setting.has_capture_output_used()) {
     48    apm->SetRuntimeSetting(
     49        AudioProcessing::RuntimeSetting::CreateCaptureOutputUsedSetting(
     50            setting.capture_output_used()));
     51  }
     52 }
     53 }  // namespace webrtc