| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool SetFec(bool enable) override; | 81 bool SetFec(bool enable) override; |
| 82 | 82 |
| 83 // Set Opus DTX. Once enabled, Opus stops transmission, when it detects voice | 83 // Set Opus DTX. Once enabled, Opus stops transmission, when it detects voice |
| 84 // being inactive. During that, it still sends 2 packets (one for content, one | 84 // being inactive. During that, it still sends 2 packets (one for content, one |
| 85 // for signaling) about every 400 ms. | 85 // for signaling) about every 400 ms. |
| 86 bool SetDtx(bool enable) override; | 86 bool SetDtx(bool enable) override; |
| 87 bool GetDtx() const override; | 87 bool GetDtx() const override; |
| 88 | 88 |
| 89 bool SetApplication(Application application) override; | 89 bool SetApplication(Application application) override; |
| 90 void SetMaxPlaybackRate(int frequency_hz) override; | 90 void SetMaxPlaybackRate(int frequency_hz) override; |
| 91 void SetProjectedPacketLossRate(double fraction) override; | |
| 92 void SetTargetBitrate(int target_bps) override; | |
| 93 | |
| 94 bool EnableAudioNetworkAdaptor(const std::string& config_string, | 91 bool EnableAudioNetworkAdaptor(const std::string& config_string, |
| 95 const Clock* clock) override; | 92 const Clock* clock) override; |
| 96 void DisableAudioNetworkAdaptor() override; | 93 void DisableAudioNetworkAdaptor() override; |
| 97 void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps) override; | 94 void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps) override; |
| 98 void OnReceivedUplinkPacketLossFraction( | 95 void OnReceivedUplinkPacketLossFraction( |
| 99 float uplink_packet_loss_fraction) override; | 96 float uplink_packet_loss_fraction) override; |
| 100 void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) override; | 97 void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) override; |
| 101 void OnReceivedRtt(int rtt_ms) override; | 98 void OnReceivedRtt(int rtt_ms) override; |
| 102 void SetReceiverFrameLengthRange(int min_frame_length_ms, | 99 void SetReceiverFrameLengthRange(int min_frame_length_ms, |
| 103 int max_frame_length_ms) override; | 100 int max_frame_length_ms) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 114 rtc::ArrayView<const int16_t> audio, | 111 rtc::ArrayView<const int16_t> audio, |
| 115 rtc::Buffer* encoded) override; | 112 rtc::Buffer* encoded) override; |
| 116 | 113 |
| 117 private: | 114 private: |
| 118 size_t Num10msFramesPerPacket() const; | 115 size_t Num10msFramesPerPacket() const; |
| 119 size_t SamplesPer10msFrame() const; | 116 size_t SamplesPer10msFrame() const; |
| 120 size_t SufficientOutputBufferSize() const; | 117 size_t SufficientOutputBufferSize() const; |
| 121 bool RecreateEncoderInstance(const Config& config); | 118 bool RecreateEncoderInstance(const Config& config); |
| 122 void SetFrameLength(int frame_length_ms); | 119 void SetFrameLength(int frame_length_ms); |
| 123 void SetNumChannelsToEncode(size_t num_channels_to_encode); | 120 void SetNumChannelsToEncode(size_t num_channels_to_encode); |
| 121 void SetProjectedPacketLossRate(double fraction); |
| 122 void SetTargetBitrate(int target_bps); |
| 124 void ApplyAudioNetworkAdaptor(); | 123 void ApplyAudioNetworkAdaptor(); |
| 125 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( | 124 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( |
| 126 const std::string& config_string, | 125 const std::string& config_string, |
| 127 const Clock* clock) const; | 126 const Clock* clock) const; |
| 128 | 127 |
| 129 Config config_; | 128 Config config_; |
| 130 double packet_loss_rate_; | 129 double packet_loss_rate_; |
| 131 std::vector<int16_t> input_buffer_; | 130 std::vector<int16_t> input_buffer_; |
| 132 OpusEncInst* inst_; | 131 OpusEncInst* inst_; |
| 133 uint32_t first_timestamp_in_buffer_; | 132 uint32_t first_timestamp_in_buffer_; |
| 134 size_t num_channels_to_encode_; | 133 size_t num_channels_to_encode_; |
| 135 int next_frame_length_ms_; | 134 int next_frame_length_ms_; |
| 136 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; | 135 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; |
| 137 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; | 136 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; |
| 138 | 137 |
| 139 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); | 138 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| 140 }; | 139 }; |
| 141 | 140 |
| 142 } // namespace webrtc | 141 } // namespace webrtc |
| 143 | 142 |
| 144 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 143 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| OLD | NEW |