| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| 13 | 13 |
| 14 #include <functional> | 14 #include <functional> |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/constructormagic.h" | 19 #include "webrtc/base/constructormagic.h" |
| 20 #include "webrtc/base/optional.h" | 20 #include "webrtc/base/optional.h" |
| 21 #include "webrtc/base/protobuf_utils.h" |
| 21 #include "webrtc/common_audio/smoothing_filter.h" | 22 #include "webrtc/common_audio/smoothing_filter.h" |
| 22 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ
k_adaptor.h" | 23 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ
k_adaptor.h" |
| 23 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" | 24 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" |
| 24 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 25 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| 25 | 26 |
| 26 namespace webrtc { | 27 namespace webrtc { |
| 27 | 28 |
| 28 class RtcEventLog; | 29 class RtcEventLog; |
| 29 | 30 |
| 30 struct CodecInst; | 31 struct CodecInst; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void SetFrameLength(int frame_length_ms); | 148 void SetFrameLength(int frame_length_ms); |
| 148 void SetNumChannelsToEncode(size_t num_channels_to_encode); | 149 void SetNumChannelsToEncode(size_t num_channels_to_encode); |
| 149 void SetProjectedPacketLossRate(float fraction); | 150 void SetProjectedPacketLossRate(float fraction); |
| 150 | 151 |
| 151 // TODO(minyue): remove "override" when we can deprecate | 152 // TODO(minyue): remove "override" when we can deprecate |
| 152 // |AudioEncoder::SetTargetBitrate|. | 153 // |AudioEncoder::SetTargetBitrate|. |
| 153 void SetTargetBitrate(int target_bps) override; | 154 void SetTargetBitrate(int target_bps) override; |
| 154 | 155 |
| 155 void ApplyAudioNetworkAdaptor(); | 156 void ApplyAudioNetworkAdaptor(); |
| 156 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( | 157 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( |
| 157 const std::string& config_string, | 158 const ProtoString& config_string, |
| 158 RtcEventLog* event_log, | 159 RtcEventLog* event_log, |
| 159 const Clock* clock) const; | 160 const Clock* clock) const; |
| 160 | 161 |
| 161 void MaybeUpdateUplinkBandwidth(); | 162 void MaybeUpdateUplinkBandwidth(); |
| 162 | 163 |
| 163 Config config_; | 164 Config config_; |
| 164 const bool send_side_bwe_with_overhead_; | 165 const bool send_side_bwe_with_overhead_; |
| 165 float packet_loss_rate_; | 166 float packet_loss_rate_; |
| 166 std::vector<int16_t> input_buffer_; | 167 std::vector<int16_t> input_buffer_; |
| 167 OpusEncInst* inst_; | 168 OpusEncInst* inst_; |
| 168 uint32_t first_timestamp_in_buffer_; | 169 uint32_t first_timestamp_in_buffer_; |
| 169 size_t num_channels_to_encode_; | 170 size_t num_channels_to_encode_; |
| 170 int next_frame_length_ms_; | 171 int next_frame_length_ms_; |
| 171 int complexity_; | 172 int complexity_; |
| 172 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; | 173 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; |
| 173 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; | 174 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; |
| 174 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; | 175 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; |
| 175 rtc::Optional<size_t> overhead_bytes_per_packet_; | 176 rtc::Optional<size_t> overhead_bytes_per_packet_; |
| 176 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; | 177 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; |
| 177 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; | 178 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; |
| 178 | 179 |
| 179 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); | 180 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| 180 }; | 181 }; |
| 181 | 182 |
| 182 } // namespace webrtc | 183 } // namespace webrtc |
| 183 | 184 |
| 184 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 185 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| OLD | NEW |