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

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

Issue 2924093002: Revert of Refactored incoming bitrate estimator. (Closed)
Patch Set: 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);
53 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); 52 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms);
54 bool LatestEstimate(std::vector<uint32_t>* ssrcs, 53 bool LatestEstimate(std::vector<uint32_t>* ssrcs,
55 uint32_t* bitrate_bps) const; 54 uint32_t* bitrate_bps) const;
56 void SetStartBitrate(int start_bitrate_bps); 55 void SetStartBitrate(int start_bitrate_bps);
57 void SetMinBitrate(int min_bitrate_bps); 56 void SetMinBitrate(int min_bitrate_bps);
58 int64_t GetExpectedBwePeriodMs() const; 57 int64_t GetExpectedBwePeriodMs() const;
59 58
60 private: 59 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
61 void IncomingPacketFeedback(const PacketFeedback& packet_feedback); 80 void IncomingPacketFeedback(const PacketFeedback& packet_feedback);
62 Result OnLongFeedbackDelay(int64_t arrival_time_ms); 81 Result OnLongFeedbackDelay(int64_t arrival_time_ms);
63 82
64 Result MaybeUpdateEstimate(bool overusing, 83 Result MaybeUpdateEstimate(bool overusing);
65 rtc::Optional<uint32_t> acked_bitrate_bps);
66 // Updates the current remote rate estimate and returns true if a valid 84 // Updates the current remote rate estimate and returns true if a valid
67 // estimate exists. 85 // estimate exists.
68 bool UpdateEstimate(int64_t now_ms, 86 bool UpdateEstimate(int64_t now_ms,
69 rtc::Optional<uint32_t> acked_bitrate_bps, 87 rtc::Optional<uint32_t> acked_bitrate_bps,
70 bool overusing, 88 bool overusing,
71 uint32_t* target_bitrate_bps); 89 uint32_t* target_bitrate_bps);
72 90
73 rtc::ThreadChecker network_thread_; 91 rtc::ThreadChecker network_thread_;
74 RtcEventLog* const event_log_; 92 RtcEventLog* const event_log_;
75 const Clock* const clock_; 93 const Clock* const clock_;
76 std::unique_ptr<InterArrival> inter_arrival_; 94 std::unique_ptr<InterArrival> inter_arrival_;
77 std::unique_ptr<TrendlineEstimator> trendline_estimator_; 95 std::unique_ptr<TrendlineEstimator> trendline_estimator_;
78 OveruseDetector detector_; 96 OveruseDetector detector_;
97 BitrateEstimator receiver_incoming_bitrate_;
79 int64_t last_seen_packet_ms_; 98 int64_t last_seen_packet_ms_;
80 bool uma_recorded_; 99 bool uma_recorded_;
81 AimdRateControl rate_control_; 100 AimdRateControl rate_control_;
82 ProbeBitrateEstimator probe_bitrate_estimator_; 101 ProbeBitrateEstimator probe_bitrate_estimator_;
83 size_t trendline_window_size_; 102 size_t trendline_window_size_;
84 double trendline_smoothing_coeff_; 103 double trendline_smoothing_coeff_;
85 double trendline_threshold_gain_; 104 double trendline_threshold_gain_;
86 int consecutive_delayed_feedbacks_; 105 int consecutive_delayed_feedbacks_;
87 uint32_t last_logged_bitrate_; 106 uint32_t last_logged_bitrate_;
88 BandwidthUsage last_logged_state_; 107 BandwidthUsage last_logged_state_;
89 bool in_sparse_update_experiment_; 108 bool in_sparse_update_experiment_;
90 109
91 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); 110 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe);
92 }; 111 };
93 112
94 } // namespace webrtc 113 } // namespace webrtc
95 114
96 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ 115 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698