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