OLD | NEW |
(Empty) | |
| 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 WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_ |
| 12 #define WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_ |
| 13 |
| 14 #include <stddef.h> |
| 15 |
| 16 #include <vector> |
| 17 |
| 18 #include "webrtc/base/optional.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 // NOTE: This struct is still under development and may change without notice. |
| 23 struct 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 size_t num_channels; |
| 40 enum class ApplicationMode { kVoip, kAudio }; |
| 41 ApplicationMode application; |
| 42 |
| 43 // NOTE: This member must always be set. |
| 44 // TODO(kwiberg): Turn it into just an int. |
| 45 rtc::Optional<int> bitrate_bps; |
| 46 |
| 47 bool fec_enabled; |
| 48 bool cbr_enabled; |
| 49 int max_playback_rate_hz; |
| 50 |
| 51 // |complexity| is used when the bitrate goes above |
| 52 // |complexity_threshold_bps| + |complexity_threshold_window_bps|; |
| 53 // |low_rate_complexity| is used when the bitrate falls below |
| 54 // |complexity_threshold_bps| - |complexity_threshold_window_bps|. In the |
| 55 // interval in the middle, we keep using the most recent of the two |
| 56 // complexity settings. |
| 57 int complexity; |
| 58 int low_rate_complexity; |
| 59 int complexity_threshold_bps; |
| 60 int complexity_threshold_window_bps; |
| 61 |
| 62 bool dtx_enabled; |
| 63 std::vector<int> supported_frame_lengths_ms; |
| 64 int uplink_bandwidth_update_interval_ms; |
| 65 |
| 66 // NOTE: This member isn't necessary, and will soon go away. See |
| 67 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7847 |
| 68 int payload_type; |
| 69 }; |
| 70 |
| 71 } // namespace webrtc |
| 72 |
| 73 #endif // WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_ |
OLD | NEW |