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 |
11 #ifndef WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ | 11 #ifndef WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ |
12 #define WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ | 12 #define WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ |
13 | 13 |
14 #include "webrtc/common_types.h" | 14 #include "webrtc/common_types.h" |
15 #include "webrtc/modules/pacing/interval_budget.h" | 15 #include "webrtc/modules/pacing/interval_budget.h" |
16 #include "webrtc/modules/pacing/paced_sender.h" | 16 #include "webrtc/modules/pacing/paced_sender.h" |
17 #include "webrtc/rtc_base/optional.h" | 17 #include "webrtc/rtc_base/optional.h" |
18 #include "webrtc/rtc_base/rate_statistics.h" | 18 #include "webrtc/rtc_base/rate_statistics.h" |
19 #include "webrtc/typedefs.h" | 19 #include "webrtc/typedefs.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 | 22 |
| 23 class RtcEventLog; |
| 24 |
23 // Application limited region detector is a class that utilizes signals of | 25 // Application limited region detector is a class that utilizes signals of |
24 // elapsed time and bytes sent to estimate whether network traffic is | 26 // elapsed time and bytes sent to estimate whether network traffic is |
25 // currently limited by the application's ability to generate traffic. | 27 // currently limited by the application's ability to generate traffic. |
26 // | 28 // |
27 // AlrDetector provides a signal that can be utilized to adjust | 29 // AlrDetector provides a signal that can be utilized to adjust |
28 // estimate bandwidth. | 30 // estimate bandwidth. |
29 // Note: This class is not thread-safe. | 31 // Note: This class is not thread-safe. |
30 class AlrDetector { | 32 class AlrDetector { |
31 public: | 33 public: |
32 AlrDetector(); | 34 AlrDetector(); |
| 35 explicit AlrDetector(RtcEventLog* event_log); |
33 ~AlrDetector(); | 36 ~AlrDetector(); |
34 | 37 |
35 void OnBytesSent(size_t bytes_sent, int64_t delta_time_ms); | 38 void OnBytesSent(size_t bytes_sent, int64_t delta_time_ms); |
36 | 39 |
37 // Set current estimated bandwidth. | 40 // Set current estimated bandwidth. |
38 void SetEstimatedBitrate(int bitrate_bps); | 41 void SetEstimatedBitrate(int bitrate_bps); |
39 | 42 |
40 // Returns time in milliseconds when the current application-limited region | 43 // Returns time in milliseconds when the current application-limited region |
41 // started or empty result if the sender is currently not application-limited. | 44 // started or empty result if the sender is currently not application-limited. |
42 rtc::Optional<int64_t> GetApplicationLimitedRegionStartTime() const; | 45 rtc::Optional<int64_t> GetApplicationLimitedRegionStartTime() const; |
(...skipping 22 matching lines...) Expand all Loading... |
65 void UpdateBudgetWithElapsedTime(int64_t delta_time_ms); | 68 void UpdateBudgetWithElapsedTime(int64_t delta_time_ms); |
66 void UpdateBudgetWithBytesSent(size_t bytes_sent); | 69 void UpdateBudgetWithBytesSent(size_t bytes_sent); |
67 | 70 |
68 private: | 71 private: |
69 int bandwidth_usage_percent_; | 72 int bandwidth_usage_percent_; |
70 int alr_start_budget_level_percent_; | 73 int alr_start_budget_level_percent_; |
71 int alr_stop_budget_level_percent_; | 74 int alr_stop_budget_level_percent_; |
72 | 75 |
73 IntervalBudget alr_budget_; | 76 IntervalBudget alr_budget_; |
74 rtc::Optional<int64_t> alr_started_time_ms_; | 77 rtc::Optional<int64_t> alr_started_time_ms_; |
| 78 RtcEventLog* event_log_; |
75 }; | 79 }; |
76 | 80 |
77 } // namespace webrtc | 81 } // namespace webrtc |
78 | 82 |
79 #endif // WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ | 83 #endif // WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ |
OLD | NEW |