| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class AudioEncoderOpus final : public AudioEncoder { | 24 class AudioEncoderOpus final : public AudioEncoder { |
| 25 public: | 25 public: |
| 26 enum ApplicationMode { | 26 enum ApplicationMode { |
| 27 kVoip = 0, | 27 kVoip = 0, |
| 28 kAudio = 1, | 28 kAudio = 1, |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 struct Config { | 31 struct Config { |
| 32 bool IsOk() const; | 32 bool IsOk() const; |
| 33 int frame_size_ms = 20; | 33 int frame_size_ms = 20; |
| 34 int num_channels = 1; | 34 size_t num_channels = 1; |
| 35 int payload_type = 120; | 35 int payload_type = 120; |
| 36 ApplicationMode application = kVoip; | 36 ApplicationMode application = kVoip; |
| 37 int bitrate_bps = 64000; | 37 int bitrate_bps = 64000; |
| 38 bool fec_enabled = false; | 38 bool fec_enabled = false; |
| 39 int max_playback_rate_hz = 48000; | 39 int max_playback_rate_hz = 48000; |
| 40 int complexity = kDefaultComplexity; | 40 int complexity = kDefaultComplexity; |
| 41 bool dtx_enabled = false; | 41 bool dtx_enabled = false; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM) | 44 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM) |
| 45 // If we are on Android, iOS and/or ARM, use a lower complexity setting as | 45 // If we are on Android, iOS and/or ARM, use a lower complexity setting as |
| 46 // default, to save encoder complexity. | 46 // default, to save encoder complexity. |
| 47 static const int kDefaultComplexity = 5; | 47 static const int kDefaultComplexity = 5; |
| 48 #else | 48 #else |
| 49 static const int kDefaultComplexity = 9; | 49 static const int kDefaultComplexity = 9; |
| 50 #endif | 50 #endif |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 explicit AudioEncoderOpus(const Config& config); | 53 explicit AudioEncoderOpus(const Config& config); |
| 54 explicit AudioEncoderOpus(const CodecInst& codec_inst); | 54 explicit AudioEncoderOpus(const CodecInst& codec_inst); |
| 55 ~AudioEncoderOpus() override; | 55 ~AudioEncoderOpus() override; |
| 56 | 56 |
| 57 size_t MaxEncodedBytes() const override; | 57 size_t MaxEncodedBytes() const override; |
| 58 int SampleRateHz() const override; | 58 int SampleRateHz() const override; |
| 59 int NumChannels() const override; | 59 size_t NumChannels() const override; |
| 60 size_t Num10MsFramesInNextPacket() const override; | 60 size_t Num10MsFramesInNextPacket() const override; |
| 61 size_t Max10MsFramesInAPacket() const override; | 61 size_t Max10MsFramesInAPacket() const override; |
| 62 int GetTargetBitrate() const override; | 62 int GetTargetBitrate() const override; |
| 63 | 63 |
| 64 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, | 64 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, |
| 65 rtc::ArrayView<const int16_t> audio, | 65 rtc::ArrayView<const int16_t> audio, |
| 66 size_t max_encoded_bytes, | 66 size_t max_encoded_bytes, |
| 67 uint8_t* encoded) override; | 67 uint8_t* encoded) override; |
| 68 | 68 |
| 69 void Reset() override; | 69 void Reset() override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 93 double packet_loss_rate_; | 93 double packet_loss_rate_; |
| 94 std::vector<int16_t> input_buffer_; | 94 std::vector<int16_t> input_buffer_; |
| 95 OpusEncInst* inst_; | 95 OpusEncInst* inst_; |
| 96 uint32_t first_timestamp_in_buffer_; | 96 uint32_t first_timestamp_in_buffer_; |
| 97 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); | 97 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace webrtc | 100 } // namespace webrtc |
| 101 | 101 |
| 102 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 102 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| OLD | NEW |