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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 return bitrate_bps <= complexity_threshold_bps | 168 return bitrate_bps <= complexity_threshold_bps |
169 ? rtc::Optional<int>(low_rate_complexity) | 169 ? rtc::Optional<int>(low_rate_complexity) |
170 : rtc::Optional<int>(complexity); | 170 : rtc::Optional<int>(complexity); |
171 } | 171 } |
172 | 172 |
173 AudioEncoderOpus::AudioEncoderOpus( | 173 AudioEncoderOpus::AudioEncoderOpus( |
174 const Config& config, | 174 const Config& config, |
175 AudioNetworkAdaptorCreator&& audio_network_adaptor_creator, | 175 AudioNetworkAdaptorCreator&& audio_network_adaptor_creator, |
176 std::unique_ptr<SmoothingFilter> bitrate_smoother) | 176 std::unique_ptr<SmoothingFilter> bitrate_smoother) |
177 : packet_loss_rate_(0.0), | 177 : send_side_bwe_with_overhead_(webrtc::field_trial::FindFullName( |
| 178 "WebRTC-SendSideBwe-WithOverhead") == "Enabled"), |
| 179 packet_loss_rate_(0.0), |
178 inst_(nullptr), | 180 inst_(nullptr), |
179 packet_loss_fraction_smoother_(new PacketLossFractionSmoother( | 181 packet_loss_fraction_smoother_(new PacketLossFractionSmoother( |
180 config.clock)), | 182 config.clock)), |
181 audio_network_adaptor_creator_( | 183 audio_network_adaptor_creator_( |
182 audio_network_adaptor_creator | 184 audio_network_adaptor_creator |
183 ? std::move(audio_network_adaptor_creator) | 185 ? std::move(audio_network_adaptor_creator) |
184 : [this](const std::string& config_string, | 186 : [this](const std::string& config_string, |
185 RtcEventLog* event_log, | 187 RtcEventLog* event_log, |
186 const Clock* clock) { | 188 const Clock* clock) { |
187 return DefaultAudioNetworkAdaptorCreator(config_string, | 189 return DefaultAudioNetworkAdaptorCreator(config_string, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // In order to limit the affect of a BWE spike within 25% of its value | 309 // In order to limit the affect of a BWE spike within 25% of its value |
308 // before | 310 // before |
309 // the next probing, we would choose a time constant that fulfills | 311 // the next probing, we would choose a time constant that fulfills |
310 // 1 - e^(-probing_interval_ms / time_constant) < 0.25 | 312 // 1 - e^(-probing_interval_ms / time_constant) < 0.25 |
311 // Then 4 * probing_interval_ms is a good choice. | 313 // Then 4 * probing_interval_ms is a good choice. |
312 if (probing_interval_ms) | 314 if (probing_interval_ms) |
313 bitrate_smoother_->SetTimeConstantMs(*probing_interval_ms * 4); | 315 bitrate_smoother_->SetTimeConstantMs(*probing_interval_ms * 4); |
314 bitrate_smoother_->AddSample(target_audio_bitrate_bps); | 316 bitrate_smoother_->AddSample(target_audio_bitrate_bps); |
315 | 317 |
316 ApplyAudioNetworkAdaptor(); | 318 ApplyAudioNetworkAdaptor(); |
317 } else if (webrtc::field_trial::FindFullName( | 319 } else if (send_side_bwe_with_overhead_) { |
318 "WebRTC-SendSideBwe-WithOverhead") == "Enabled") { | |
319 if (!overhead_bytes_per_packet_) { | 320 if (!overhead_bytes_per_packet_) { |
320 LOG(LS_INFO) | 321 LOG(LS_INFO) |
321 << "AudioEncoderOpus: Overhead unknown, target audio bitrate " | 322 << "AudioEncoderOpus: Overhead unknown, target audio bitrate " |
322 << target_audio_bitrate_bps << " bps is ignored."; | 323 << target_audio_bitrate_bps << " bps is ignored."; |
323 return; | 324 return; |
324 } | 325 } |
325 const int overhead_bps = static_cast<int>( | 326 const int overhead_bps = static_cast<int>( |
326 *overhead_bytes_per_packet_ * 8 * 100 / Num10MsFramesInNextPacket()); | 327 *overhead_bytes_per_packet_ * 8 * 100 / Num10MsFramesInNextPacket()); |
327 SetTargetBitrate(std::min( | 328 SetTargetBitrate(std::min( |
328 kMaxBitrateBps, | 329 kMaxBitrateBps, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 config_.uplink_bandwidth_update_interval_ms) { | 551 config_.uplink_bandwidth_update_interval_ms) { |
551 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); | 552 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); |
552 if (smoothed_bitrate) | 553 if (smoothed_bitrate) |
553 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); | 554 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); |
554 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); | 555 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); |
555 } | 556 } |
556 } | 557 } |
557 } | 558 } |
558 | 559 |
559 } // namespace webrtc | 560 } // namespace webrtc |
OLD | NEW |