| 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 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 enum ApplicationMode { | 28 enum ApplicationMode { |
| 29 kVoip = 0, | 29 kVoip = 0, |
| 30 kAudio = 1, | 30 kAudio = 1, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 struct Config { | 33 struct Config { |
| 34 Config(); | 34 Config(); |
| 35 bool IsOk() const; | 35 bool IsOk() const; |
| 36 int frame_size_ms; | 36 int frame_size_ms; |
| 37 int num_channels; | 37 size_t num_channels; |
| 38 int payload_type; | 38 int payload_type; |
| 39 ApplicationMode application; | 39 ApplicationMode application; |
| 40 int bitrate_bps; | 40 int bitrate_bps; |
| 41 bool fec_enabled; | 41 bool fec_enabled; |
| 42 int max_playback_rate_hz; | 42 int max_playback_rate_hz; |
| 43 int complexity; | 43 int complexity; |
| 44 bool dtx_enabled; | 44 bool dtx_enabled; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 explicit AudioEncoderOpus(const Config& config); | 47 explicit AudioEncoderOpus(const Config& config); |
| 48 ~AudioEncoderOpus() override; | 48 ~AudioEncoderOpus() override; |
| 49 | 49 |
| 50 int SampleRateHz() const override; | 50 int SampleRateHz() const override; |
| 51 int NumChannels() const override; | 51 size_t NumChannels() const override; |
| 52 size_t MaxEncodedBytes() const override; | 52 size_t MaxEncodedBytes() const override; |
| 53 size_t Num10MsFramesInNextPacket() const override; | 53 size_t Num10MsFramesInNextPacket() const override; |
| 54 size_t Max10MsFramesInAPacket() const override; | 54 size_t Max10MsFramesInAPacket() const override; |
| 55 int GetTargetBitrate() const override; | 55 int GetTargetBitrate() const override; |
| 56 void SetTargetBitrate(int bits_per_second) override; | 56 void SetTargetBitrate(int bits_per_second) override; |
| 57 void SetProjectedPacketLossRate(double fraction) override; | 57 void SetProjectedPacketLossRate(double fraction) override; |
| 58 | 58 |
| 59 double packet_loss_rate() const { return packet_loss_rate_; } | 59 double packet_loss_rate() const { return packet_loss_rate_; } |
| 60 ApplicationMode application() const { return application_; } | 60 ApplicationMode application() const { return application_; } |
| 61 bool dtx_enabled() const { return dtx_enabled_; } | 61 bool dtx_enabled() const { return dtx_enabled_; } |
| 62 | 62 |
| 63 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, | 63 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, |
| 64 const int16_t* audio, | 64 const int16_t* audio, |
| 65 size_t max_encoded_bytes, | 65 size_t max_encoded_bytes, |
| 66 uint8_t* encoded) override; | 66 uint8_t* encoded) override; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 const size_t num_10ms_frames_per_packet_; | 69 const size_t num_10ms_frames_per_packet_; |
| 70 const int num_channels_; | 70 const size_t num_channels_; |
| 71 const int payload_type_; | 71 const int payload_type_; |
| 72 const ApplicationMode application_; | 72 const ApplicationMode application_; |
| 73 int bitrate_bps_; | 73 int bitrate_bps_; |
| 74 const bool dtx_enabled_; | 74 const bool dtx_enabled_; |
| 75 const size_t samples_per_10ms_frame_; | 75 const size_t samples_per_10ms_frame_; |
| 76 std::vector<int16_t> input_buffer_; | 76 std::vector<int16_t> input_buffer_; |
| 77 OpusEncInst* inst_; | 77 OpusEncInst* inst_; |
| 78 uint32_t first_timestamp_in_buffer_; | 78 uint32_t first_timestamp_in_buffer_; |
| 79 double packet_loss_rate_; | 79 double packet_loss_rate_; |
| 80 }; | 80 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 return encoder()->packet_loss_rate(); | 103 return encoder()->packet_loss_rate(); |
| 104 } | 104 } |
| 105 bool dtx_enabled() const { | 105 bool dtx_enabled() const { |
| 106 CriticalSectionScoped cs(encoder_lock_.get()); | 106 CriticalSectionScoped cs(encoder_lock_.get()); |
| 107 return encoder()->dtx_enabled(); | 107 return encoder()->dtx_enabled(); |
| 108 } | 108 } |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace webrtc | 111 } // namespace webrtc |
| 112 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_INTERFACE_AUDIO_ENCODER_OPUS_
H_ | 112 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_INTERFACE_AUDIO_ENCODER_OPUS_
H_ |
| OLD | NEW |