| 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 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adapto
r_impl.h" | 22 #include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adapto
r_impl.h" |
| 23 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h
" | 23 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h
" |
| 24 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" | 24 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" |
| 25 #include "webrtc/system_wrappers/include/field_trial.h" | 25 #include "webrtc/system_wrappers/include/field_trial.h" |
| 26 | 26 |
| 27 namespace webrtc { | 27 namespace webrtc { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 constexpr int kSampleRateHz = 48000; | 31 constexpr int kSampleRateHz = 48000; |
| 32 constexpr int kMinBitrateBps = 500; | 32 |
| 33 // Opus API allows a min bitrate of 500bps, but Opus documentation suggests |
| 34 // a minimum bitrate of 6kbps. |
| 35 constexpr int kMinBitrateBps = 6000; |
| 36 |
| 33 constexpr int kMaxBitrateBps = 512000; | 37 constexpr int kMaxBitrateBps = 512000; |
| 34 constexpr int kSupportedFrameLengths[] = {20, 60}; | 38 constexpr int kSupportedFrameLengths[] = {20, 60}; |
| 35 | 39 |
| 36 // PacketLossFractionSmoother uses an exponential filter with a time constant | 40 // PacketLossFractionSmoother uses an exponential filter with a time constant |
| 37 // of -1.0 / ln(0.9999) = 10000 ms. | 41 // of -1.0 / ln(0.9999) = 10000 ms. |
| 38 constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f; | 42 constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f; |
| 39 | 43 |
| 40 AudioEncoderOpus::Config CreateConfig(const CodecInst& codec_inst) { | 44 AudioEncoderOpus::Config CreateConfig(const CodecInst& codec_inst) { |
| 41 AudioEncoderOpus::Config config; | 45 AudioEncoderOpus::Config config; |
| 42 config.frame_size_ms = rtc::CheckedDivExact(codec_inst.pacsize, 48); | 46 config.frame_size_ms = rtc::CheckedDivExact(codec_inst.pacsize, 48); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 config_.uplink_bandwidth_update_interval_ms) { | 555 config_.uplink_bandwidth_update_interval_ms) { |
| 552 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); | 556 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); |
| 553 if (smoothed_bitrate) | 557 if (smoothed_bitrate) |
| 554 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); | 558 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); |
| 555 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); | 559 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); |
| 556 } | 560 } |
| 557 } | 561 } |
| 558 } | 562 } |
| 559 | 563 |
| 560 } // namespace webrtc | 564 } // namespace webrtc |
| OLD | NEW |