OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 #include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller_plr_b
ased.h" | 11 #include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller_plr_b
ased.h" |
12 | 12 |
13 #include <limits> | 13 #include <limits> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 17 #include "webrtc/system_wrappers/include/field_trial.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 namespace { | 21 namespace { |
21 // TODO(elad.alon): Subsequent CL experiments with PLR source. | |
22 constexpr bool kUseTwccPlrForAna = false; | |
23 | |
24 class NullSmoothingFilter final : public SmoothingFilter { | 22 class NullSmoothingFilter final : public SmoothingFilter { |
25 public: | 23 public: |
26 void AddSample(float sample) override { | 24 void AddSample(float sample) override { |
27 last_sample_ = rtc::Optional<float>(sample); | 25 last_sample_ = rtc::Optional<float>(sample); |
28 } | 26 } |
29 | 27 |
30 rtc::Optional<float> GetAverage() override { return last_sample_; } | 28 rtc::Optional<float> GetAverage() override { return last_sample_; } |
31 | 29 |
32 bool SetTimeConstantMs(int time_constant_ms) override { | 30 bool SetTimeConstantMs(int time_constant_ms) override { |
33 RTC_NOTREACHED(); | 31 RTC_NOTREACHED(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 RTC_DCHECK_LE( | 76 RTC_DCHECK_LE( |
79 GetPacketLossThreshold(config_.fec_enabling_threshold.high_bandwidth_bps, | 77 GetPacketLossThreshold(config_.fec_enabling_threshold.high_bandwidth_bps, |
80 config_.fec_disabling_threshold, | 78 config_.fec_disabling_threshold, |
81 fec_disabling_threshold_info_), | 79 fec_disabling_threshold_info_), |
82 config_.fec_enabling_threshold.high_bandwidth_packet_loss); | 80 config_.fec_enabling_threshold.high_bandwidth_packet_loss); |
83 } | 81 } |
84 | 82 |
85 FecControllerPlrBased::FecControllerPlrBased(const Config& config) | 83 FecControllerPlrBased::FecControllerPlrBased(const Config& config) |
86 : FecControllerPlrBased( | 84 : FecControllerPlrBased( |
87 config, | 85 config, |
88 kUseTwccPlrForAna | 86 webrtc::field_trial::FindFullName("UseTwccPlrForAna") == "Enabled" |
89 ? std::unique_ptr<NullSmoothingFilter>(new NullSmoothingFilter()) | 87 ? std::unique_ptr<NullSmoothingFilter>(new NullSmoothingFilter()) |
90 : std::unique_ptr<SmoothingFilter>( | 88 : std::unique_ptr<SmoothingFilter>( |
91 new SmoothingFilterImpl(config.time_constant_ms, | 89 new SmoothingFilterImpl(config.time_constant_ms, |
92 config.clock))) {} | 90 config.clock))) {} |
93 | 91 |
94 FecControllerPlrBased::~FecControllerPlrBased() = default; | 92 FecControllerPlrBased::~FecControllerPlrBased() = default; |
95 | 93 |
96 void FecControllerPlrBased::UpdateNetworkMetrics( | 94 void FecControllerPlrBased::UpdateNetworkMetrics( |
97 const NetworkMetrics& network_metrics) { | 95 const NetworkMetrics& network_metrics) { |
98 if (network_metrics.uplink_bandwidth_bps) | 96 if (network_metrics.uplink_bandwidth_bps) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (!uplink_bandwidth_bps_) | 160 if (!uplink_bandwidth_bps_) |
163 return false; | 161 return false; |
164 if (!packet_loss) | 162 if (!packet_loss) |
165 return false; | 163 return false; |
166 return *packet_loss <= GetPacketLossThreshold(*uplink_bandwidth_bps_, | 164 return *packet_loss <= GetPacketLossThreshold(*uplink_bandwidth_bps_, |
167 config_.fec_disabling_threshold, | 165 config_.fec_disabling_threshold, |
168 fec_disabling_threshold_info_); | 166 fec_disabling_threshold_info_); |
169 } | 167 } |
170 | 168 |
171 } // namespace webrtc | 169 } // namespace webrtc |
OLD | NEW |