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/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 class RtcEventLog; | 25 class RtcEventLog; |
26 | 26 |
27 class SendSideBandwidthEstimation { | 27 class SendSideBandwidthEstimation { |
28 public: | 28 public: |
29 SendSideBandwidthEstimation(); | 29 SendSideBandwidthEstimation(RtcEventLog* event_log); |
the sun
2016/03/21 13:03:09
explicit
ivoc
2016/03/22 13:44:55
Thanks, done.
| |
30 virtual ~SendSideBandwidthEstimation(); | 30 virtual ~SendSideBandwidthEstimation(); |
31 | 31 |
32 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const; | 32 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const; |
33 | 33 |
34 // Call periodically to update estimate. | 34 // Call periodically to update estimate. |
35 void UpdateEstimate(int64_t now_ms); | 35 void UpdateEstimate(int64_t now_ms); |
36 | 36 |
37 // Call when we receive a RTCP message with TMMBR or REMB. | 37 // Call when we receive a RTCP message with TMMBR or REMB. |
38 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth); | 38 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth); |
39 | 39 |
40 // Call when a new delay-based estimate is available. | 40 // Call when a new delay-based estimate is available. |
41 void UpdateDelayBasedEstimate(int64_t now_ms, uint32_t bitrate_bps); | 41 void UpdateDelayBasedEstimate(int64_t now_ms, uint32_t bitrate_bps); |
42 | 42 |
43 // Call when we receive a RTCP message with a ReceiveBlock. | 43 // Call when we receive a RTCP message with a ReceiveBlock. |
44 void UpdateReceiverBlock(uint8_t fraction_loss, | 44 void UpdateReceiverBlock(uint8_t fraction_loss, |
45 int64_t rtt, | 45 int64_t rtt, |
46 int number_of_packets, | 46 int number_of_packets, |
47 int64_t now_ms); | 47 int64_t now_ms); |
48 | 48 |
49 void SetSendBitrate(int bitrate); | 49 void SetSendBitrate(int bitrate); |
50 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); | 50 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); |
51 int GetMinBitrate() const; | 51 int GetMinBitrate() const; |
52 | 52 |
53 void SetEventLog(RtcEventLog* event_log); | |
54 | |
55 private: | 53 private: |
56 enum UmaState { kNoUpdate, kFirstDone, kDone }; | 54 enum UmaState { kNoUpdate, kFirstDone, kDone }; |
57 | 55 |
58 bool IsInStartPhase(int64_t now_ms) const; | 56 bool IsInStartPhase(int64_t now_ms) const; |
59 | 57 |
60 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); | 58 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); |
61 | 59 |
62 // Returns the input bitrate capped to the thresholds defined by the max, | 60 // Returns the input bitrate capped to the thresholds defined by the max, |
63 // min and incoming bandwidth. | 61 // min and incoming bandwidth. |
64 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); | 62 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); |
(...skipping 20 matching lines...) Expand all Loading... | |
85 int64_t last_round_trip_time_ms_; | 83 int64_t last_round_trip_time_ms_; |
86 | 84 |
87 uint32_t bwe_incoming_; | 85 uint32_t bwe_incoming_; |
88 uint32_t delay_based_bitrate_bps_; | 86 uint32_t delay_based_bitrate_bps_; |
89 int64_t time_last_decrease_ms_; | 87 int64_t time_last_decrease_ms_; |
90 int64_t first_report_time_ms_; | 88 int64_t first_report_time_ms_; |
91 int initially_lost_packets_; | 89 int initially_lost_packets_; |
92 int bitrate_at_2_seconds_kbps_; | 90 int bitrate_at_2_seconds_kbps_; |
93 UmaState uma_update_state_; | 91 UmaState uma_update_state_; |
94 std::vector<bool> rampup_uma_stats_updated_; | 92 std::vector<bool> rampup_uma_stats_updated_; |
95 RtcEventLog* event_log_; | 93 RtcEventLog* event_log_; |
the sun
2016/03/21 13:03:09
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS
ivoc
2016/03/22 13:44:55
Done.
| |
96 }; | 94 }; |
97 } // namespace webrtc | 95 } // namespace webrtc |
98 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ | 96 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ |
OLD | NEW |