Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: webrtc/modules/audio_coding/audio_network_adaptor/fec_controller_plr_based.cc

Issue 2687433004: TWCC-PLR -based FecController doesn’t need smoothing (Closed)
Patch Set: nit fixed Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 namespace {
21 // TODO(elad.alon): Subsequent CL experiments with PLR source.
22 constexpr bool kUseTwccPlrForAna = false;
23
24 class NullSmoothingFilter final : public SmoothingFilter {
25 public:
26 void AddSample(float sample) override {
27 last_sample_ = rtc::Optional<float>(sample);
28 }
29
30 rtc::Optional<float> GetAverage() override { return last_sample_; }
31
32 bool SetTimeConstantMs(int time_constant_ms) override {
33 RTC_NOTREACHED();
34 return false;
35 }
36
37 private:
38 rtc::Optional<float> last_sample_;
39 };
40 }
41
20 FecControllerPlrBased::Config::Threshold::Threshold( 42 FecControllerPlrBased::Config::Threshold::Threshold(
21 int low_bandwidth_bps, 43 int low_bandwidth_bps,
22 float low_bandwidth_packet_loss, 44 float low_bandwidth_packet_loss,
23 int high_bandwidth_bps, 45 int high_bandwidth_bps,
24 float high_bandwidth_packet_loss) 46 float high_bandwidth_packet_loss)
25 : low_bandwidth_bps(low_bandwidth_bps), 47 : low_bandwidth_bps(low_bandwidth_bps),
26 low_bandwidth_packet_loss(low_bandwidth_packet_loss), 48 low_bandwidth_packet_loss(low_bandwidth_packet_loss),
27 high_bandwidth_bps(high_bandwidth_bps), 49 high_bandwidth_bps(high_bandwidth_bps),
28 high_bandwidth_packet_loss(high_bandwidth_packet_loss) {} 50 high_bandwidth_packet_loss(high_bandwidth_packet_loss) {}
29 51
(...skipping 26 matching lines...) Expand all
56 RTC_DCHECK_LE( 78 RTC_DCHECK_LE(
57 GetPacketLossThreshold(config_.fec_enabling_threshold.high_bandwidth_bps, 79 GetPacketLossThreshold(config_.fec_enabling_threshold.high_bandwidth_bps,
58 config_.fec_disabling_threshold, 80 config_.fec_disabling_threshold,
59 fec_disabling_threshold_info_), 81 fec_disabling_threshold_info_),
60 config_.fec_enabling_threshold.high_bandwidth_packet_loss); 82 config_.fec_enabling_threshold.high_bandwidth_packet_loss);
61 } 83 }
62 84
63 FecControllerPlrBased::FecControllerPlrBased(const Config& config) 85 FecControllerPlrBased::FecControllerPlrBased(const Config& config)
64 : FecControllerPlrBased( 86 : FecControllerPlrBased(
65 config, 87 config,
66 std::unique_ptr<SmoothingFilter>( 88 kUseTwccPlrForAna
67 new SmoothingFilterImpl(config.time_constant_ms, config.clock))) { 89 ? std::unique_ptr<NullSmoothingFilter>(new NullSmoothingFilter())
68 } 90 : std::unique_ptr<SmoothingFilter>(
91 new SmoothingFilterImpl(config.time_constant_ms,
92 config.clock))) {}
69 93
70 FecControllerPlrBased::~FecControllerPlrBased() = default; 94 FecControllerPlrBased::~FecControllerPlrBased() = default;
71 95
72 void FecControllerPlrBased::UpdateNetworkMetrics( 96 void FecControllerPlrBased::UpdateNetworkMetrics(
73 const NetworkMetrics& network_metrics) { 97 const NetworkMetrics& network_metrics) {
74 if (network_metrics.uplink_bandwidth_bps) 98 if (network_metrics.uplink_bandwidth_bps)
75 uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps; 99 uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps;
76 if (network_metrics.uplink_packet_loss_fraction) { 100 if (network_metrics.uplink_packet_loss_fraction) {
77 packet_loss_smoother_->AddSample( 101 packet_loss_smoother_->AddSample(
78 *network_metrics.uplink_packet_loss_fraction); 102 *network_metrics.uplink_packet_loss_fraction);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (!uplink_bandwidth_bps_) 162 if (!uplink_bandwidth_bps_)
139 return false; 163 return false;
140 if (!packet_loss) 164 if (!packet_loss)
141 return false; 165 return false;
142 return *packet_loss <= GetPacketLossThreshold(*uplink_bandwidth_bps_, 166 return *packet_loss <= GetPacketLossThreshold(*uplink_bandwidth_bps_,
143 config_.fec_disabling_threshold, 167 config_.fec_disabling_threshold,
144 fec_disabling_threshold_info_); 168 fec_disabling_threshold_info_);
145 } 169 }
146 170
147 } // namespace webrtc 171 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698