tor-browser

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

voip_volume_control.h (2412B)


      1 /*
      2 *  Copyright (c) 2020 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 #ifndef API_VOIP_VOIP_VOLUME_CONTROL_H_
     12 #define API_VOIP_VOIP_VOLUME_CONTROL_H_
     13 
     14 #include "api/voip/voip_base.h"
     15 
     16 namespace webrtc {
     17 
     18 struct VolumeInfo {
     19  // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats-audiolevel
     20  double audio_level = 0;
     21  // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats-totalaudioenergy
     22  double total_energy = 0.0;
     23  // https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats-totalsamplesduration
     24  double total_duration = 0.0;
     25 };
     26 
     27 // VoipVolumeControl interface.
     28 //
     29 // This sub-API supports functions related to the input (microphone) and output
     30 // (speaker) device.
     31 //
     32 // Caller must ensure that ChannelId is valid otherwise it will result in no-op
     33 // with error logging.
     34 class VoipVolumeControl {
     35 public:
     36  // Mute/unmutes the microphone input sample before encoding process. Note that
     37  // mute doesn't affect audio input level and energy values as input sample is
     38  // silenced after the measurement.
     39  // Returns following VoipResult;
     40  //  kOk - input source muted or unmuted as provided by `enable`.
     41  //  kInvalidArgument - `channel_id` is invalid.
     42  virtual VoipResult SetInputMuted(ChannelId channel_id, bool enable) = 0;
     43 
     44  // Gets the microphone volume info via `volume_info` reference.
     45  // Returns following VoipResult;
     46  //  kOk - successfully set provided input volume info.
     47  //  kInvalidArgument - `channel_id` is invalid.
     48  virtual VoipResult GetInputVolumeInfo(ChannelId channel_id,
     49                                        VolumeInfo& volume_info) = 0;
     50 
     51  // Gets the speaker volume info via `volume_info` reference.
     52  // Returns following VoipResult;
     53  //  kOk - successfully set provided output volume info.
     54  //  kInvalidArgument - `channel_id` is invalid.
     55  virtual VoipResult GetOutputVolumeInfo(ChannelId channel_id,
     56                                         VolumeInfo& volume_info) = 0;
     57 
     58 protected:
     59  virtual ~VoipVolumeControl() = default;
     60 };
     61 
     62 }  // namespace webrtc
     63 
     64 #endif  // API_VOIP_VOIP_VOLUME_CONTROL_H_