1 /* 2 * Copyright (c) 2019 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_MULTI_CHANNEL_OPUS_CONFIG_H_ 12 #define API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_CONFIG_H_ 13 14 #include <stddef.h> 15 16 #include <vector> 17 18 #include "absl/types/optional.h" 19 #include "api/audio_codecs/opus/audio_encoder_opus_config.h" 20 #include "rtc_base/system/rtc_export.h" 21 22 namespace webrtc { 23 24 struct RTC_EXPORT AudioEncoderMultiChannelOpusConfig { 25 static constexpr int kDefaultFrameSizeMs = 20; 26 27 // Opus API allows a min bitrate of 500bps, but Opus documentation suggests 28 // bitrate should be in the range of 6000 to 510000, inclusive. 29 static constexpr int kMinBitrateBps = 6000; 30 static constexpr int kMaxBitrateBps = 510000; 31 32 AudioEncoderMultiChannelOpusConfig(); 33 AudioEncoderMultiChannelOpusConfig(const AudioEncoderMultiChannelOpusConfig&); 34 ~AudioEncoderMultiChannelOpusConfig(); 35 AudioEncoderMultiChannelOpusConfig& operator=( 36 const AudioEncoderMultiChannelOpusConfig&); 37 38 int frame_size_ms; 39 size_t num_channels; 40 enum class ApplicationMode { kVoip, kAudio }; 41 ApplicationMode application; 42 int bitrate_bps; 43 bool fec_enabled; 44 bool cbr_enabled; 45 bool dtx_enabled; 46 int max_playback_rate_hz; 47 std::vector<int> supported_frame_lengths_ms; 48 49 int complexity; 50 51 // Number of mono/stereo Opus streams. 52 int num_streams; 53 54 // Number of channel pairs coupled together, see RFC 7845 section 55 // 5.1.1. Has to be less than the number of streams 56 int coupled_streams; 57 58 // Channel mapping table, defines the mapping from encoded streams to input 59 // channels. See RFC 7845 section 5.1.1. 60 std::vector<unsigned char> channel_mapping; 61 62 bool IsOk() const; 63 }; 64 65 } // namespace webrtc 66 #endif // API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_CONFIG_H_ 67