OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ | |
12 #define WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ | |
13 | |
14 #include "webrtc/common_types.h" | |
15 #include "webrtc/typedefs.h" | |
16 | |
17 namespace webrtc { | |
18 | |
19 // Application limited region detector is a class that utilizes signals of | |
20 // elapsed time and bytes sent to estimate whether network traffic is | |
21 // currently limited by the application's ability to generate traffic. | |
22 // | |
23 // AlrDetector provides a signal that can be utilized to adjust | |
24 // estimate bandwidth. | |
25 // Note: This class is not thread-safe. | |
26 class AlrDetector { | |
27 public: | |
28 AlrDetector(); | |
29 ~AlrDetector(); | |
30 // Reports time delta elapsed since the last call |ReportElapsedTime|. | |
31 void ReportElapsedTime(int64_t delta_time_ms); | |
32 // Reports bytes sent out since the last call |ReportBytesSent|. | |
33 void ReportBytesSent(size_t bytes); | |
philipel
2016/09/15 15:00:20
Internally we try to keep everything in bits. I kn
Irfan
2016/09/19 06:51:13
I think we should keep that change outside this si
| |
34 // Set current estimated bandwidth. | |
35 void SetEstimatedBitrate(int bitrate_bps); | |
36 // Returns true if currently in application-limited region. | |
37 bool InApplicationLimitedRegion(); | |
38 | |
39 private: | |
40 int total_bytes_sent_; | |
41 int64_t total_elapsed_time_ms_; | |
42 int estimated_bitrate_bps_; | |
43 // Number of consecutive periods over which we observe traffic is application | |
44 // limited. | |
45 int application_limited_count_; | |
46 }; | |
47 | |
48 } // namespace webrtc | |
49 | |
50 #endif // WEBRTC_MODULES_PACING_ALR_DETECTOR_H_ | |
OLD | NEW |