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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "webrtc/modules/congestion_controller/probing_interval_estimator.h" | 24 #include "webrtc/modules/congestion_controller/probing_interval_estimator.h" |
25 #include "webrtc/modules/congestion_controller/trendline_estimator.h" | 25 #include "webrtc/modules/congestion_controller/trendline_estimator.h" |
26 #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" | 26 #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" |
27 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 27 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
28 #include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" | 28 #include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" |
29 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" | 29 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" |
30 #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" | 30 #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" |
31 | 31 |
32 namespace webrtc { | 32 namespace webrtc { |
33 | 33 |
| 34 class RtcEventLog; |
| 35 |
34 class DelayBasedBwe { | 36 class DelayBasedBwe { |
35 public: | 37 public: |
36 static const int64_t kStreamTimeOutMs = 2000; | 38 static const int64_t kStreamTimeOutMs = 2000; |
37 | 39 |
38 struct Result { | 40 struct Result { |
39 Result() : updated(false), probe(false), target_bitrate_bps(0) {} | 41 Result() : updated(false), probe(false), target_bitrate_bps(0) {} |
40 Result(bool probe, uint32_t target_bitrate_bps) | 42 Result(bool probe, uint32_t target_bitrate_bps) |
41 : updated(true), probe(probe), target_bitrate_bps(target_bitrate_bps) {} | 43 : updated(true), probe(probe), target_bitrate_bps(target_bitrate_bps) {} |
42 bool updated; | 44 bool updated; |
43 bool probe; | 45 bool probe; |
44 uint32_t target_bitrate_bps; | 46 uint32_t target_bitrate_bps; |
45 }; | 47 }; |
46 | 48 |
47 explicit DelayBasedBwe(Clock* clock); | 49 DelayBasedBwe(RtcEventLog* event_log, Clock* clock); |
48 virtual ~DelayBasedBwe() {} | 50 virtual ~DelayBasedBwe() {} |
49 | 51 |
50 Result IncomingPacketFeedbackVector( | 52 Result IncomingPacketFeedbackVector( |
51 const std::vector<PacketInfo>& packet_feedback_vector); | 53 const std::vector<PacketInfo>& packet_feedback_vector); |
52 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); | 54 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); |
53 bool LatestEstimate(std::vector<uint32_t>* ssrcs, | 55 bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
54 uint32_t* bitrate_bps) const; | 56 uint32_t* bitrate_bps) const; |
55 void SetStartBitrate(int start_bitrate_bps); | 57 void SetStartBitrate(int start_bitrate_bps); |
56 void SetMinBitrate(int min_bitrate_bps); | 58 void SetMinBitrate(int min_bitrate_bps); |
57 int64_t GetProbingIntervalMs() const; | 59 int64_t GetProbingIntervalMs() const; |
(...skipping 26 matching lines...) Expand all Loading... |
84 // Updates the current remote rate estimate and returns true if a valid | 86 // Updates the current remote rate estimate and returns true if a valid |
85 // estimate exists. | 87 // estimate exists. |
86 bool UpdateEstimate(int64_t packet_arrival_time_ms, | 88 bool UpdateEstimate(int64_t packet_arrival_time_ms, |
87 int64_t now_ms, | 89 int64_t now_ms, |
88 rtc::Optional<uint32_t> acked_bitrate_bps, | 90 rtc::Optional<uint32_t> acked_bitrate_bps, |
89 uint32_t* target_bitrate_bps); | 91 uint32_t* target_bitrate_bps); |
90 const bool in_trendline_experiment_; | 92 const bool in_trendline_experiment_; |
91 const bool in_median_slope_experiment_; | 93 const bool in_median_slope_experiment_; |
92 | 94 |
93 rtc::ThreadChecker network_thread_; | 95 rtc::ThreadChecker network_thread_; |
| 96 RtcEventLog* const event_log_; |
94 Clock* const clock_; | 97 Clock* const clock_; |
95 std::unique_ptr<InterArrival> inter_arrival_; | 98 std::unique_ptr<InterArrival> inter_arrival_; |
96 std::unique_ptr<OveruseEstimator> kalman_estimator_; | 99 std::unique_ptr<OveruseEstimator> kalman_estimator_; |
97 std::unique_ptr<TrendlineEstimator> trendline_estimator_; | 100 std::unique_ptr<TrendlineEstimator> trendline_estimator_; |
98 std::unique_ptr<MedianSlopeEstimator> median_slope_estimator_; | 101 std::unique_ptr<MedianSlopeEstimator> median_slope_estimator_; |
99 OveruseDetector detector_; | 102 OveruseDetector detector_; |
100 BitrateEstimator receiver_incoming_bitrate_; | 103 BitrateEstimator receiver_incoming_bitrate_; |
101 int64_t last_update_ms_; | 104 int64_t last_update_ms_; |
102 int64_t last_seen_packet_ms_; | 105 int64_t last_seen_packet_ms_; |
103 bool uma_recorded_; | 106 bool uma_recorded_; |
104 AimdRateControl rate_control_; | 107 AimdRateControl rate_control_; |
105 ProbeBitrateEstimator probe_bitrate_estimator_; | 108 ProbeBitrateEstimator probe_bitrate_estimator_; |
106 size_t trendline_window_size_; | 109 size_t trendline_window_size_; |
107 double trendline_smoothing_coeff_; | 110 double trendline_smoothing_coeff_; |
108 double trendline_threshold_gain_; | 111 double trendline_threshold_gain_; |
109 ProbingIntervalEstimator probing_interval_estimator_; | 112 ProbingIntervalEstimator probing_interval_estimator_; |
110 size_t median_slope_window_size_; | 113 size_t median_slope_window_size_; |
111 double median_slope_threshold_gain_; | 114 double median_slope_threshold_gain_; |
112 int consecutive_delayed_feedbacks_; | 115 int consecutive_delayed_feedbacks_; |
| 116 uint32_t last_logged_bitrate_; |
| 117 BandwidthUsage last_logged_state_; |
113 | 118 |
114 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); | 119 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); |
115 }; | 120 }; |
116 | 121 |
117 } // namespace webrtc | 122 } // namespace webrtc |
118 | 123 |
119 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ | 124 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
OLD | NEW |