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 13 matching lines...) Expand all Loading... |
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 constexpr int kMinBitrateBps = 500; |
33 constexpr int kMaxBitrateBps = 512000; | 33 constexpr int kMaxBitrateBps = 512000; |
| 34 |
| 35 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME |
| 36 constexpr int kSupportedFrameLengths[] = {20, 60, 120}; |
| 37 #else |
34 constexpr int kSupportedFrameLengths[] = {20, 60}; | 38 constexpr int kSupportedFrameLengths[] = {20, 60}; |
| 39 #endif |
35 | 40 |
36 // PacketLossFractionSmoother uses an exponential filter with a time constant | 41 // PacketLossFractionSmoother uses an exponential filter with a time constant |
37 // of -1.0 / ln(0.9999) = 10000 ms. | 42 // of -1.0 / ln(0.9999) = 10000 ms. |
38 constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f; | 43 constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f; |
39 | 44 |
40 AudioEncoderOpus::Config CreateConfig(const CodecInst& codec_inst) { | 45 AudioEncoderOpus::Config CreateConfig(const CodecInst& codec_inst) { |
41 AudioEncoderOpus::Config config; | 46 AudioEncoderOpus::Config config; |
42 config.frame_size_ms = rtc::CheckedDivExact(codec_inst.pacsize, 48); | 47 config.frame_size_ms = rtc::CheckedDivExact(codec_inst.pacsize, 48); |
43 config.num_channels = codec_inst.channels; | 48 config.num_channels = codec_inst.channels; |
44 config.bitrate_bps = rtc::Optional<int>(codec_inst.rate); | 49 config.bitrate_bps = rtc::Optional<int>(codec_inst.rate); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 config_.uplink_bandwidth_update_interval_ms) { | 556 config_.uplink_bandwidth_update_interval_ms) { |
552 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); | 557 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); |
553 if (smoothed_bitrate) | 558 if (smoothed_bitrate) |
554 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); | 559 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); |
555 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); | 560 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); |
556 } | 561 } |
557 } | 562 } |
558 } | 563 } |
559 | 564 |
560 } // namespace webrtc | 565 } // namespace webrtc |
OLD | NEW |