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 12 matching lines...) Expand all Loading... |
23 public: | 23 public: |
24 SendSideBandwidthEstimation(); | 24 SendSideBandwidthEstimation(); |
25 virtual ~SendSideBandwidthEstimation(); | 25 virtual ~SendSideBandwidthEstimation(); |
26 | 26 |
27 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const; | 27 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const; |
28 | 28 |
29 // Call periodically to update estimate. | 29 // Call periodically to update estimate. |
30 void UpdateEstimate(int64_t now_ms); | 30 void UpdateEstimate(int64_t now_ms); |
31 | 31 |
32 // Call when we receive a RTCP message with TMMBR or REMB. | 32 // Call when we receive a RTCP message with TMMBR or REMB. |
33 void UpdateReceiverEstimate(uint32_t bandwidth); | 33 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth); |
34 | 34 |
35 // Call when we receive a RTCP message with a ReceiveBlock. | 35 // Call when we receive a RTCP message with a ReceiveBlock. |
36 void UpdateReceiverBlock(uint8_t fraction_loss, | 36 void UpdateReceiverBlock(uint8_t fraction_loss, |
37 int64_t rtt, | 37 int64_t rtt, |
38 int number_of_packets, | 38 int number_of_packets, |
39 int64_t now_ms); | 39 int64_t now_ms); |
40 | 40 |
41 void SetSendBitrate(int bitrate); | 41 void SetSendBitrate(int bitrate); |
42 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); | 42 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); |
43 int GetMinBitrate() const; | 43 int GetMinBitrate() const; |
44 | 44 |
45 private: | 45 private: |
46 enum UmaState { kNoUpdate, kFirstDone, kDone }; | 46 enum UmaState { kNoUpdate, kFirstDone, kDone }; |
47 | 47 |
48 bool IsInStartPhase(int64_t now_ms) const; | 48 bool IsInStartPhase(int64_t now_ms) const; |
49 | 49 |
50 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); | 50 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); |
51 | 51 |
52 // Returns the input bitrate capped to the thresholds defined by the max, | 52 // Returns the input bitrate capped to the thresholds defined by the max, |
53 // min and incoming bandwidth. | 53 // min and incoming bandwidth. |
54 uint32_t CapBitrateToThresholds(uint32_t bitrate); | 54 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); |
55 | 55 |
56 // Updates history of min bitrates. | 56 // Updates history of min bitrates. |
57 // After this method returns min_bitrate_history_.front().second contains the | 57 // After this method returns min_bitrate_history_.front().second contains the |
58 // min bitrate used during last kBweIncreaseIntervalMs. | 58 // min bitrate used during last kBweIncreaseIntervalMs. |
59 void UpdateMinHistory(int64_t now_ms); | 59 void UpdateMinHistory(int64_t now_ms); |
60 | 60 |
61 std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_; | 61 std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_; |
62 | 62 |
63 // incoming filters | 63 // incoming filters |
64 int accumulate_lost_packets_Q8_; | 64 int accumulate_lost_packets_Q8_; |
65 int accumulate_expected_packets_; | 65 int accumulate_expected_packets_; |
66 | 66 |
67 uint32_t bitrate_; | 67 uint32_t bitrate_; |
68 uint32_t min_bitrate_configured_; | 68 uint32_t min_bitrate_configured_; |
69 uint32_t max_bitrate_configured_; | 69 uint32_t max_bitrate_configured_; |
| 70 int64_t last_low_bitrate_log_ms_; |
70 | 71 |
71 int64_t time_last_receiver_block_ms_; | 72 int64_t time_last_receiver_block_ms_; |
72 uint8_t last_fraction_loss_; | 73 uint8_t last_fraction_loss_; |
73 int64_t last_round_trip_time_ms_; | 74 int64_t last_round_trip_time_ms_; |
74 | 75 |
75 uint32_t bwe_incoming_; | 76 uint32_t bwe_incoming_; |
76 int64_t time_last_decrease_ms_; | 77 int64_t time_last_decrease_ms_; |
77 int64_t first_report_time_ms_; | 78 int64_t first_report_time_ms_; |
78 int initially_lost_packets_; | 79 int initially_lost_packets_; |
79 int bitrate_at_2_seconds_kbps_; | 80 int bitrate_at_2_seconds_kbps_; |
80 UmaState uma_update_state_; | 81 UmaState uma_update_state_; |
81 std::vector<bool> rampup_uma_stats_updated_; | 82 std::vector<bool> rampup_uma_stats_updated_; |
82 }; | 83 }; |
83 } // namespace webrtc | 84 } // namespace webrtc |
84 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ | 85 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ |
OLD | NEW |