| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace webrtc { | 30 namespace webrtc { |
| 31 | 31 |
| 32 class RtcEventLog; | 32 class RtcEventLog; |
| 33 | 33 |
| 34 class DelayBasedBwe { | 34 class DelayBasedBwe { |
| 35 public: | 35 public: |
| 36 static const int64_t kStreamTimeOutMs = 2000; | 36 static const int64_t kStreamTimeOutMs = 2000; |
| 37 | 37 |
| 38 struct Result { | 38 struct Result { |
| 39 Result() : updated(false), probe(false), target_bitrate_bps(0) {} | 39 Result(); |
| 40 Result(bool probe, uint32_t target_bitrate_bps) | 40 Result(bool probe, uint32_t target_bitrate_bps); |
| 41 : updated(true), probe(probe), target_bitrate_bps(target_bitrate_bps) {} | 41 Result(bool probe, |
| 42 uint32_t target_bitrate_bps, |
| 43 uint32_t suggested_probe_bps); |
| 44 ~Result(); |
| 42 bool updated; | 45 bool updated; |
| 43 bool probe; | 46 bool probe; |
| 44 uint32_t target_bitrate_bps; | 47 uint32_t target_bitrate_bps; |
| 48 rtc::Optional<uint32_t> suggested_probe_bps; |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 DelayBasedBwe(RtcEventLog* event_log, const Clock* clock); | 51 DelayBasedBwe(RtcEventLog* event_log, const Clock* clock); |
| 48 virtual ~DelayBasedBwe(); | 52 virtual ~DelayBasedBwe(); |
| 49 | 53 |
| 50 Result IncomingPacketFeedbackVector( | 54 Result IncomingPacketFeedbackVector( |
| 51 const std::vector<PacketFeedback>& packet_feedback_vector, | 55 const std::vector<PacketFeedback>& packet_feedback_vector, |
| 52 rtc::Optional<uint32_t> acked_bitrate_bps); | 56 rtc::Optional<uint32_t> acked_bitrate_bps); |
| 53 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); | 57 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); |
| 54 bool LatestEstimate(std::vector<uint32_t>* ssrcs, | 58 bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
| 55 uint32_t* bitrate_bps) const; | 59 uint32_t* bitrate_bps) const; |
| 56 void SetStartBitrate(int start_bitrate_bps); | 60 void SetStartBitrate(int start_bitrate_bps); |
| 57 void SetMinBitrate(int min_bitrate_bps); | 61 void SetMinBitrate(int min_bitrate_bps); |
| 58 int64_t GetExpectedBwePeriodMs() const; | 62 int64_t GetExpectedBwePeriodMs() const; |
| 59 | 63 |
| 60 private: | 64 private: |
| 61 void IncomingPacketFeedback(const PacketFeedback& packet_feedback); | 65 void IncomingPacketFeedback(const PacketFeedback& packet_feedback); |
| 62 Result OnLongFeedbackDelay(int64_t arrival_time_ms); | 66 Result OnLongFeedbackDelay(int64_t arrival_time_ms); |
| 63 | |
| 64 Result MaybeUpdateEstimate(bool overusing, | 67 Result MaybeUpdateEstimate(bool overusing, |
| 65 rtc::Optional<uint32_t> acked_bitrate_bps); | 68 rtc::Optional<uint32_t> acked_bitrate_bps, |
| 69 bool request_probe); |
| 66 // Updates the current remote rate estimate and returns true if a valid | 70 // Updates the current remote rate estimate and returns true if a valid |
| 67 // estimate exists. | 71 // estimate exists. |
| 68 bool UpdateEstimate(int64_t now_ms, | 72 bool UpdateEstimate(int64_t now_ms, |
| 69 rtc::Optional<uint32_t> acked_bitrate_bps, | 73 rtc::Optional<uint32_t> acked_bitrate_bps, |
| 70 bool overusing, | 74 bool overusing, |
| 71 uint32_t* target_bitrate_bps); | 75 uint32_t* target_bitrate_bps); |
| 72 | 76 |
| 73 rtc::RaceChecker network_race_; | 77 rtc::RaceChecker network_race_; |
| 74 RtcEventLog* const event_log_; | 78 RtcEventLog* const event_log_; |
| 75 const Clock* const clock_; | 79 const Clock* const clock_; |
| 76 std::unique_ptr<InterArrival> inter_arrival_; | 80 std::unique_ptr<InterArrival> inter_arrival_; |
| 77 std::unique_ptr<TrendlineEstimator> trendline_estimator_; | 81 std::unique_ptr<TrendlineEstimator> trendline_estimator_; |
| 78 OveruseDetector detector_; | 82 OveruseDetector detector_; |
| 79 int64_t last_seen_packet_ms_; | 83 int64_t last_seen_packet_ms_; |
| 80 bool uma_recorded_; | 84 bool uma_recorded_; |
| 81 AimdRateControl rate_control_; | 85 AimdRateControl rate_control_; |
| 82 ProbeBitrateEstimator probe_bitrate_estimator_; | 86 ProbeBitrateEstimator probe_bitrate_estimator_; |
| 83 size_t trendline_window_size_; | 87 size_t trendline_window_size_; |
| 84 double trendline_smoothing_coeff_; | 88 double trendline_smoothing_coeff_; |
| 85 double trendline_threshold_gain_; | 89 double trendline_threshold_gain_; |
| 86 int consecutive_delayed_feedbacks_; | 90 int consecutive_delayed_feedbacks_; |
| 91 uint32_t bitrate_before_last_large_drop_; |
| 92 int64_t time_of_last_large_drop_ms_; |
| 87 uint32_t last_logged_bitrate_; | 93 uint32_t last_logged_bitrate_; |
| 88 BandwidthUsage last_logged_state_; | 94 BandwidthUsage last_logged_state_; |
| 89 bool in_sparse_update_experiment_; | 95 bool in_sparse_update_experiment_; |
| 90 | 96 |
| 91 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); | 97 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); |
| 92 }; | 98 }; |
| 93 | 99 |
| 94 } // namespace webrtc | 100 } // namespace webrtc |
| 95 | 101 |
| 96 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ | 102 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
| OLD | NEW |