tor-browser

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

audio_encoder_opus_config.h (2399B)


      1 /*
      2 *  Copyright (c) 2017 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_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_
     12 #define API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_
     13 
     14 #include <stddef.h>
     15 
     16 #include <optional>
     17 #include <vector>
     18 
     19 #include "rtc_base/system/rtc_export.h"
     20 
     21 namespace webrtc {
     22 
     23 struct RTC_EXPORT AudioEncoderOpusConfig {
     24  static constexpr int kDefaultFrameSizeMs = 20;
     25 
     26  // Opus API allows a min bitrate of 500bps, but Opus documentation suggests
     27  // bitrate should be in the range of 6000 to 510000, inclusive.
     28  static constexpr int kMinBitrateBps = 6000;
     29  static constexpr int kMaxBitrateBps = 510000;
     30 
     31  AudioEncoderOpusConfig();
     32  AudioEncoderOpusConfig(const AudioEncoderOpusConfig&);
     33  ~AudioEncoderOpusConfig();
     34  AudioEncoderOpusConfig& operator=(const AudioEncoderOpusConfig&);
     35 
     36  bool IsOk() const;  // Checks if the values are currently OK.
     37 
     38  int frame_size_ms;
     39  int sample_rate_hz;
     40  size_t num_channels;
     41  enum class ApplicationMode { kVoip, kAudio };
     42  ApplicationMode application;
     43 
     44  // NOTE: This member must always be set.
     45  // TODO(kwiberg): Turn it into just an int.
     46  std::optional<int> bitrate_bps;
     47 
     48  bool fec_enabled;
     49  bool cbr_enabled;
     50  int max_playback_rate_hz;
     51 
     52  // `complexity` is used when the bitrate goes above
     53  // `complexity_threshold_bps` + `complexity_threshold_window_bps`;
     54  // `low_rate_complexity` is used when the bitrate falls below
     55  // `complexity_threshold_bps` - `complexity_threshold_window_bps`. In the
     56  // interval in the middle, we keep using the most recent of the two
     57  // complexity settings.
     58  int complexity;
     59  int low_rate_complexity;
     60  int complexity_threshold_bps;
     61  int complexity_threshold_window_bps;
     62 
     63  bool dtx_enabled;
     64  std::vector<int> supported_frame_lengths_ms;
     65  int uplink_bandwidth_update_interval_ms;
     66 
     67  // NOTE: This member isn't necessary, and will soon go away. See
     68  // https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
     69  int payload_type;
     70 };
     71 
     72 }  // namespace webrtc
     73 
     74 #endif  // API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_