| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 void SetFrameLength(int frame_length_ms); | 150 void SetFrameLength(int frame_length_ms); |
| 150 void SetNumChannelsToEncode(size_t num_channels_to_encode); | 151 void SetNumChannelsToEncode(size_t num_channels_to_encode); |
| 151 void SetProjectedPacketLossRate(float fraction); | 152 void SetProjectedPacketLossRate(float fraction); |
| 152 | 153 |
| 153 // TODO(minyue): remove "override" when we can deprecate | 154 // TODO(minyue): remove "override" when we can deprecate |
| 154 // |AudioEncoder::SetTargetBitrate|. | 155 // |AudioEncoder::SetTargetBitrate|. |
| 155 void SetTargetBitrate(int target_bps) override; | 156 void SetTargetBitrate(int target_bps) override; |
| 156 | 157 |
| 157 void ApplyAudioNetworkAdaptor(); | 158 void ApplyAudioNetworkAdaptor(); |
| 158 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( | 159 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( |
| 159 const std::string& config_string, | 160 const ProtoString& config_string, |
| 160 RtcEventLog* event_log, | 161 RtcEventLog* event_log, |
| 161 const Clock* clock) const; | 162 const Clock* clock) const; |
| 162 | 163 |
| 163 void MaybeUpdateUplinkBandwidth(); | 164 void MaybeUpdateUplinkBandwidth(); |
| 164 | 165 |
| 165 Config config_; | 166 Config config_; |
| 166 const bool send_side_bwe_with_overhead_; | 167 const bool send_side_bwe_with_overhead_; |
| 167 float packet_loss_rate_; | 168 float packet_loss_rate_; |
| 168 std::vector<int16_t> input_buffer_; | 169 std::vector<int16_t> input_buffer_; |
| 169 OpusEncInst* inst_; | 170 OpusEncInst* inst_; |
| 170 uint32_t first_timestamp_in_buffer_; | 171 uint32_t first_timestamp_in_buffer_; |
| 171 size_t num_channels_to_encode_; | 172 size_t num_channels_to_encode_; |
| 172 int next_frame_length_ms_; | 173 int next_frame_length_ms_; |
| 173 int complexity_; | 174 int complexity_; |
| 174 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; | 175 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; |
| 175 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; | 176 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; |
| 176 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; | 177 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; |
| 177 rtc::Optional<size_t> overhead_bytes_per_packet_; | 178 rtc::Optional<size_t> overhead_bytes_per_packet_; |
| 178 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; | 179 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; |
| 179 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; | 180 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; |
| 180 | 181 |
| 181 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); | 182 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| 182 }; | 183 }; |
| 183 | 184 |
| 184 } // namespace webrtc | 185 } // namespace webrtc |
| 185 | 186 |
| 186 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 187 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| OLD | NEW |