OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 * FEC and NACK added bitrate is handled outside class | 10 * FEC and NACK added bitrate is handled outside class |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); | 53 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); |
54 int GetMinBitrate() const; | 54 int GetMinBitrate() const; |
55 | 55 |
56 private: | 56 private: |
57 enum UmaState { kNoUpdate, kFirstDone, kDone }; | 57 enum UmaState { kNoUpdate, kFirstDone, kDone }; |
58 | 58 |
59 bool IsInStartPhase(int64_t now_ms) const; | 59 bool IsInStartPhase(int64_t now_ms) const; |
60 | 60 |
61 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); | 61 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); |
62 | 62 |
63 // Returns the input bitrate capped to the thresholds defined by the max, | |
64 // min and incoming bandwidth. | |
65 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); | |
66 | |
67 // Updates history of min bitrates. | 63 // Updates history of min bitrates. |
68 // After this method returns min_bitrate_history_.front().second contains the | 64 // After this method returns min_bitrate_history_.front().second contains the |
69 // min bitrate used during last kBweIncreaseIntervalMs. | 65 // min bitrate used during last kBweIncreaseIntervalMs. |
70 void UpdateMinHistory(int64_t now_ms); | 66 void UpdateMinHistory(int64_t now_ms); |
71 | 67 |
| 68 // Cap |bitrate_bps| to [min_bitrate_configured_, max_bitrate_configured_] and |
| 69 // set |current_bitrate_bps_| to the capped value and updates the event log. |
| 70 void CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate_bps); |
| 71 |
72 std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_; | 72 std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_; |
73 | 73 |
74 // incoming filters | 74 // incoming filters |
75 int lost_packets_since_last_loss_update_Q8_; | 75 int lost_packets_since_last_loss_update_Q8_; |
76 int expected_packets_since_last_loss_update_; | 76 int expected_packets_since_last_loss_update_; |
77 | 77 |
78 uint32_t bitrate_; | 78 uint32_t current_bitrate_bps_; |
79 uint32_t min_bitrate_configured_; | 79 uint32_t min_bitrate_configured_; |
80 uint32_t max_bitrate_configured_; | 80 uint32_t max_bitrate_configured_; |
81 int64_t last_low_bitrate_log_ms_; | 81 int64_t last_low_bitrate_log_ms_; |
82 | 82 |
83 bool has_decreased_since_last_fraction_loss_; | 83 bool has_decreased_since_last_fraction_loss_; |
84 int64_t last_feedback_ms_; | 84 int64_t last_feedback_ms_; |
85 int64_t last_packet_report_ms_; | 85 int64_t last_packet_report_ms_; |
86 int64_t last_timeout_ms_; | 86 int64_t last_timeout_ms_; |
87 uint8_t last_fraction_loss_; | 87 uint8_t last_fraction_loss_; |
88 uint8_t last_logged_fraction_loss_; | 88 uint8_t last_logged_fraction_loss_; |
89 int64_t last_round_trip_time_ms_; | 89 int64_t last_round_trip_time_ms_; |
90 | 90 |
91 uint32_t bwe_incoming_; | 91 uint32_t bwe_incoming_; |
92 uint32_t delay_based_bitrate_bps_; | 92 uint32_t delay_based_bitrate_bps_; |
93 int64_t time_last_decrease_ms_; | 93 int64_t time_last_decrease_ms_; |
94 int64_t first_report_time_ms_; | 94 int64_t first_report_time_ms_; |
95 int initially_lost_packets_; | 95 int initially_lost_packets_; |
96 int bitrate_at_2_seconds_kbps_; | 96 int bitrate_at_2_seconds_kbps_; |
97 UmaState uma_update_state_; | 97 UmaState uma_update_state_; |
98 std::vector<bool> rampup_uma_stats_updated_; | 98 std::vector<bool> rampup_uma_stats_updated_; |
99 RtcEventLog* event_log_; | 99 RtcEventLog* event_log_; |
100 int64_t last_rtc_event_log_ms_; | 100 int64_t last_rtc_event_log_ms_; |
101 bool in_timeout_experiment_; | 101 bool in_timeout_experiment_; |
102 float low_loss_threshold_; | 102 float low_loss_threshold_; |
103 float high_loss_threshold_; | 103 float high_loss_threshold_; |
104 uint32_t bitrate_threshold_bps_; | 104 uint32_t bitrate_threshold_bps_; |
105 }; | 105 }; |
106 } // namespace webrtc | 106 } // namespace webrtc |
107 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ | 107 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ |
OLD | NEW |