| 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/api/audio_codecs/audio_format.h" | 19 #include "webrtc/api/audio_codecs/audio_format.h" |
| 20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
| 21 #include "webrtc/base/optional.h" | 21 #include "webrtc/base/optional.h" |
| 22 #include "webrtc/base/protobuf_utils.h" |
| 22 #include "webrtc/common_audio/smoothing_filter.h" | 23 #include "webrtc/common_audio/smoothing_filter.h" |
| 23 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ
k_adaptor.h" | 24 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ
k_adaptor.h" |
| 24 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 25 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| 25 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" | 26 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" |
| 26 | 27 |
| 27 namespace webrtc { | 28 namespace webrtc { |
| 28 | 29 |
| 29 class RtcEventLog; | 30 class RtcEventLog; |
| 30 | 31 |
| 31 struct CodecInst; | 32 struct CodecInst; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void SetFrameLength(int frame_length_ms); | 161 void SetFrameLength(int frame_length_ms); |
| 161 void SetNumChannelsToEncode(size_t num_channels_to_encode); | 162 void SetNumChannelsToEncode(size_t num_channels_to_encode); |
| 162 void SetProjectedPacketLossRate(float fraction); | 163 void SetProjectedPacketLossRate(float fraction); |
| 163 | 164 |
| 164 // TODO(minyue): remove "override" when we can deprecate | 165 // TODO(minyue): remove "override" when we can deprecate |
| 165 // |AudioEncoder::SetTargetBitrate|. | 166 // |AudioEncoder::SetTargetBitrate|. |
| 166 void SetTargetBitrate(int target_bps) override; | 167 void SetTargetBitrate(int target_bps) override; |
| 167 | 168 |
| 168 void ApplyAudioNetworkAdaptor(); | 169 void ApplyAudioNetworkAdaptor(); |
| 169 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( | 170 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( |
| 170 const std::string& config_string, | 171 const ProtoString& config_string, |
| 171 RtcEventLog* event_log, | 172 RtcEventLog* event_log, |
| 172 const Clock* clock) const; | 173 const Clock* clock) const; |
| 173 | 174 |
| 174 void MaybeUpdateUplinkBandwidth(); | 175 void MaybeUpdateUplinkBandwidth(); |
| 175 | 176 |
| 176 Config config_; | 177 Config config_; |
| 177 const bool send_side_bwe_with_overhead_; | 178 const bool send_side_bwe_with_overhead_; |
| 178 float packet_loss_rate_; | 179 float packet_loss_rate_; |
| 179 std::vector<int16_t> input_buffer_; | 180 std::vector<int16_t> input_buffer_; |
| 180 OpusEncInst* inst_; | 181 OpusEncInst* inst_; |
| 181 uint32_t first_timestamp_in_buffer_; | 182 uint32_t first_timestamp_in_buffer_; |
| 182 size_t num_channels_to_encode_; | 183 size_t num_channels_to_encode_; |
| 183 int next_frame_length_ms_; | 184 int next_frame_length_ms_; |
| 184 int complexity_; | 185 int complexity_; |
| 185 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; | 186 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; |
| 186 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; | 187 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; |
| 187 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; | 188 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; |
| 188 rtc::Optional<size_t> overhead_bytes_per_packet_; | 189 rtc::Optional<size_t> overhead_bytes_per_packet_; |
| 189 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; | 190 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; |
| 190 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; | 191 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; |
| 191 | 192 |
| 192 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); | 193 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| 193 }; | 194 }; |
| 194 | 195 |
| 195 } // namespace webrtc | 196 } // namespace webrtc |
| 196 | 197 |
| 197 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ | 198 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ |
| OLD | NEW |