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

Side by Side Diff: webrtc/modules/congestion_controller/delay_based_bwe.h

Issue 2917873002: Refactored incoming bitrate estimator. (Closed)
Patch Set: Respond to comments Created 3 years, 6 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
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
(...skipping 30 matching lines...) Expand all
41 : updated(true), probe(probe), target_bitrate_bps(target_bitrate_bps) {} 41 : updated(true), probe(probe), target_bitrate_bps(target_bitrate_bps) {}
42 bool updated; 42 bool updated;
43 bool probe; 43 bool probe;
44 uint32_t target_bitrate_bps; 44 uint32_t target_bitrate_bps;
45 }; 45 };
46 46
47 DelayBasedBwe(RtcEventLog* event_log, const Clock* clock); 47 DelayBasedBwe(RtcEventLog* event_log, const Clock* clock);
48 virtual ~DelayBasedBwe(); 48 virtual ~DelayBasedBwe();
49 49
50 Result IncomingPacketFeedbackVector( 50 Result IncomingPacketFeedbackVector(
51 const std::vector<PacketFeedback>& packet_feedback_vector); 51 const std::vector<PacketFeedback>& packet_feedback_vector,
52 rtc::Optional<uint32_t> acked_bitrate_bps);
52 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); 53 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms);
53 bool LatestEstimate(std::vector<uint32_t>* ssrcs, 54 bool LatestEstimate(std::vector<uint32_t>* ssrcs,
54 uint32_t* bitrate_bps) const; 55 uint32_t* bitrate_bps) const;
55 void SetStartBitrate(int start_bitrate_bps); 56 void SetStartBitrate(int start_bitrate_bps);
56 void SetMinBitrate(int min_bitrate_bps); 57 void SetMinBitrate(int min_bitrate_bps);
57 int64_t GetExpectedBwePeriodMs() const; 58 int64_t GetExpectedBwePeriodMs() const;
58 59
59 private: 60 private:
60 // Computes a bayesian estimate of the throughput given acks containing
61 // the arrival time and payload size. Samples which are far from the current
62 // estimate or are based on few packets are given a smaller weight, as they
63 // are considered to be more likely to have been caused by, e.g., delay spikes
64 // unrelated to congestion.
65 class BitrateEstimator {
66 public:
67 BitrateEstimator();
68 void Update(int64_t now_ms, int bytes);
69 rtc::Optional<uint32_t> bitrate_bps() const;
70
71 private:
72 float UpdateWindow(int64_t now_ms, int bytes, int rate_window_ms);
73 int sum_;
74 int64_t current_win_ms_;
75 int64_t prev_time_ms_;
76 float bitrate_estimate_;
77 float bitrate_estimate_var_;
78 };
79
80 void IncomingPacketFeedback(const PacketFeedback& packet_feedback); 61 void IncomingPacketFeedback(const PacketFeedback& packet_feedback);
81 Result OnLongFeedbackDelay(int64_t arrival_time_ms); 62 Result OnLongFeedbackDelay(int64_t arrival_time_ms);
82 63
83 Result MaybeUpdateEstimate(bool overusing); 64 Result MaybeUpdateEstimate(bool overusing,
65 rtc::Optional<uint32_t> acked_bitrate_bps);
84 // Updates the current remote rate estimate and returns true if a valid 66 // Updates the current remote rate estimate and returns true if a valid
85 // estimate exists. 67 // estimate exists.
86 bool UpdateEstimate(int64_t now_ms, 68 bool UpdateEstimate(int64_t now_ms,
87 rtc::Optional<uint32_t> acked_bitrate_bps, 69 rtc::Optional<uint32_t> acked_bitrate_bps,
88 bool overusing, 70 bool overusing,
89 uint32_t* target_bitrate_bps); 71 uint32_t* target_bitrate_bps);
90 72
91 rtc::ThreadChecker network_thread_; 73 rtc::ThreadChecker network_thread_;
92 RtcEventLog* const event_log_; 74 RtcEventLog* const event_log_;
93 const Clock* const clock_; 75 const Clock* const clock_;
94 std::unique_ptr<InterArrival> inter_arrival_; 76 std::unique_ptr<InterArrival> inter_arrival_;
95 std::unique_ptr<TrendlineEstimator> trendline_estimator_; 77 std::unique_ptr<TrendlineEstimator> trendline_estimator_;
96 OveruseDetector detector_; 78 OveruseDetector detector_;
97 BitrateEstimator receiver_incoming_bitrate_;
98 int64_t last_seen_packet_ms_; 79 int64_t last_seen_packet_ms_;
99 bool uma_recorded_; 80 bool uma_recorded_;
100 AimdRateControl rate_control_; 81 AimdRateControl rate_control_;
101 ProbeBitrateEstimator probe_bitrate_estimator_; 82 ProbeBitrateEstimator probe_bitrate_estimator_;
102 size_t trendline_window_size_; 83 size_t trendline_window_size_;
103 double trendline_smoothing_coeff_; 84 double trendline_smoothing_coeff_;
104 double trendline_threshold_gain_; 85 double trendline_threshold_gain_;
105 int consecutive_delayed_feedbacks_; 86 int consecutive_delayed_feedbacks_;
106 uint32_t last_logged_bitrate_; 87 uint32_t last_logged_bitrate_;
107 BandwidthUsage last_logged_state_; 88 BandwidthUsage last_logged_state_;
108 bool in_sparse_update_experiment_; 89 bool in_sparse_update_experiment_;
109 90
110 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); 91 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe);
111 }; 92 };
112 93
113 } // namespace webrtc 94 } // namespace webrtc
114 95
115 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ 96 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698