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 |
11 */ | 11 */ |
12 | 12 |
13 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ | 13 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ |
14 #define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ | 14 #define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ |
15 | 15 |
16 #include <deque> | 16 #include <deque> |
17 #include <utility> | 17 #include <utility> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
| 20 #include "webrtc/base/histogram.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 22 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 class RtcEventLog; | 26 class RtcEventLog; |
26 | 27 |
27 class SendSideBandwidthEstimation { | 28 class SendSideBandwidthEstimation { |
28 public: | 29 public: |
29 SendSideBandwidthEstimation() = delete; | 30 SendSideBandwidthEstimation() = delete; |
(...skipping 18 matching lines...) Expand all Loading... |
48 int64_t now_ms); | 49 int64_t now_ms); |
49 | 50 |
50 void SetBitrates(int send_bitrate, | 51 void SetBitrates(int send_bitrate, |
51 int min_bitrate, | 52 int min_bitrate, |
52 int max_bitrate); | 53 int max_bitrate); |
53 void SetSendBitrate(int bitrate); | 54 void SetSendBitrate(int bitrate); |
54 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); | 55 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); |
55 int GetMinBitrate() const; | 56 int GetMinBitrate() const; |
56 | 57 |
57 private: | 58 private: |
| 59 struct UmaRampUpMetric { |
| 60 rtc::Histogram histogram; |
| 61 int bitrate_kbps; |
| 62 }; |
| 63 |
58 enum UmaState { kNoUpdate, kFirstDone, kDone }; | 64 enum UmaState { kNoUpdate, kFirstDone, kDone }; |
59 | 65 |
60 bool IsInStartPhase(int64_t now_ms) const; | 66 bool IsInStartPhase(int64_t now_ms) const; |
61 | 67 |
62 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); | 68 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); |
63 | 69 |
64 // Returns the input bitrate capped to the thresholds defined by the max, | 70 // Returns the input bitrate capped to the thresholds defined by the max, |
65 // min and incoming bandwidth. | 71 // min and incoming bandwidth. |
66 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); | 72 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); |
67 | 73 |
68 // Updates history of min bitrates. | 74 // Updates history of min bitrates. |
69 // After this method returns min_bitrate_history_.front().second contains the | 75 // After this method returns min_bitrate_history_.front().second contains the |
70 // min bitrate used during last kBweIncreaseIntervalMs. | 76 // min bitrate used during last kBweIncreaseIntervalMs. |
71 void UpdateMinHistory(int64_t now_ms); | 77 void UpdateMinHistory(int64_t now_ms); |
72 | 78 |
73 std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_; | 79 std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_; |
74 | 80 |
| 81 // Note that these should be considered const on construction but are not |
| 82 // marked as such because bandwidth_estimation_ is copy assigned in |
| 83 // bitrate_controller_impl.cc. |
| 84 UmaRampUpMetric rampup_histograms_[3]; |
| 85 rtc::Histogram initially_lost_packets_histogram_; |
| 86 rtc::Histogram initial_rtt_histogram_; |
| 87 rtc::Histogram initial_bwe_histogram_; |
| 88 rtc::Histogram initial_vs_converged_diff_histogram_; |
| 89 |
75 // incoming filters | 90 // incoming filters |
76 int lost_packets_since_last_loss_update_Q8_; | 91 int lost_packets_since_last_loss_update_Q8_; |
77 int expected_packets_since_last_loss_update_; | 92 int expected_packets_since_last_loss_update_; |
78 | 93 |
79 uint32_t bitrate_; | 94 uint32_t bitrate_; |
80 uint32_t min_bitrate_configured_; | 95 uint32_t min_bitrate_configured_; |
81 uint32_t max_bitrate_configured_; | 96 uint32_t max_bitrate_configured_; |
82 int64_t last_low_bitrate_log_ms_; | 97 int64_t last_low_bitrate_log_ms_; |
83 | 98 |
84 bool has_decreased_since_last_fraction_loss_; | 99 bool has_decreased_since_last_fraction_loss_; |
(...skipping 11 matching lines...) Expand all Loading... |
96 int initially_lost_packets_; | 111 int initially_lost_packets_; |
97 int bitrate_at_2_seconds_kbps_; | 112 int bitrate_at_2_seconds_kbps_; |
98 UmaState uma_update_state_; | 113 UmaState uma_update_state_; |
99 std::vector<bool> rampup_uma_stats_updated_; | 114 std::vector<bool> rampup_uma_stats_updated_; |
100 RtcEventLog* event_log_; | 115 RtcEventLog* event_log_; |
101 int64_t last_rtc_event_log_ms_; | 116 int64_t last_rtc_event_log_ms_; |
102 bool in_timeout_experiment_; | 117 bool in_timeout_experiment_; |
103 }; | 118 }; |
104 } // namespace webrtc | 119 } // namespace webrtc |
105 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ | 120 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ |
OLD | NEW |